[KPhotoAlbum] [Gimp-developer] jpeg quality factor.

Robert L Krawitz rlk at alum.mit.edu
Sun Jul 8 13:17:46 BST 2007


   Date: Sun, 08 Jul 2007 11:44:17 +0200
   From: gg at catking.net

   On Sun, 08 Jul 2007 07:22:24 +0200, Guillermo Espertino  
   <gespertino at gmail.com> wrote:

   >  In Gimp, it saves the file directly, without asking for the compression  
   > setting. Result: an image over-compressed with artifacts. Smaller size  
   > than the original.
   > In Photoshop, it shows the quality settings the first time you hit  
   > CTRL+S.

   I think we're finally getting closer to the truth. There is something non  
   standard in the file the camera is producing. It seems that PS knows  
   there's a problem and thus prompts for the quality parameter, gimp it  
   would seem is either reading this value as the IJG quality when it isn't  
   or is applying a not too good default when it fails to read it.

   If it's an incorrect value put in by the camera that gimp is correctly  
   reading it's not a gimp issue. If it is a missing value gimp should  
   probably use it's jpeg default of 85 (or prompt as you suggest) which it  
   does not seem to be doing.

   If you have imagemagick installed, use the following to see what  
   information is in one of your camera images before you affect it with  
   either gimp or ps and then again after gimp (and/or PS) does a save on it:

   identify -verbose unadulterated_image.jpeg

   That should give some info on what is in the jpeg header.

This appears to be the case.  The original image gives me this:

$ identify -verbose /images/dcim/193canon/img_9309.jpg 
Image: /images/dcim/193canon/img_9309.jpg
...
  Filesize: 2.96358mb
...
  Compression: JPEG
  Quality: 98
  Orientation: LeftBottom
  JPEG-Colorspace: 2
  JPEG-Sampling-factors: 2x1,1x1,1x1

However, when I save it out, it's clearly not using the original
quality setting:

$ identify -verbose /tmp/img_9309.jpg 
Image: /tmp/img_9309.jpg
...
  Filesize: 901.654kb
...
  Compression: JPEG
  Quality: 85
  Orientation: TopLeft
  JPEG-Colorspace: 2
  JPEG-Sampling-factors: 2x2,1x1,1x1

If I explicitly save it out using the same settings as what came from
the file, I wind up with a slightly shrunk file:

$ identify -verbose /tmp/img_9309.jpg 
Image: /tmp/img_9309.jpg
...
  Filesize: 2.65972mb
...
  Compression: JPEG
  Quality: 98
  Orientation: TopLeft
  JPEG-Colorspace: 2
  JPEG-Sampling-factors: 2x1,1x1,1x1

Note that GIMP is not the only application that does this; KPhotoAlbum
also changes the quality setting (to 75!).  In this case, I suspect
that it simply doesn't tell the appropriate library what the actual
quality setting is from the original file.

-- 
Robert Krawitz                                     <rlk at alum.mit.edu>

Tall Clubs International  --  http://www.tall.org/ or 1-888-IM-TALL-2
Member of the League for Programming Freedom -- mail lpf at uunet.uu.net
Project lead for Gutenprint   --    http://gimp-print.sourceforge.net

"Linux doesn't dictate how I work, I dictate how Linux works."
--Eric Crampton



More information about the Kphotoalbum mailing list