vote up 0 vote down star
1

When I save a JPG file with GIMP, I can adjust the quality I save it at, from 0-100 (I use 89). It seems like I've used an app to see what this number was on saved file but if I did I can't for the life of me figure out what it was. Any suggestions as to what to use?

flag

2 Answers

vote up 4 vote down check

Once saved, you cannot tell the quality anymore.

(Setting the quality while saving just tells the software how much loss you find acceptable, but once saved: what's lost is lost. You'd need a human to say if something looks nice.)

Hmmm, I guess I was wrong. I still think the above is correct, but ImageMagick's identify proves me wrong?

identify -verbose myimage.jpg

Image: myimage.jpg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Class: DirectClass
  Geometry: 358x240+0+0
  Resolution: 300x300
  [...]
  Compression: JPEG
  Quality: 90
  Orientation: Undefined
  [...]

I don't know how the image in my test was saved, but it does not have any EXIF data. Could the quality still be stored in the image?

link|flag
Can't you experiment converting to different qualities? I find it hard to believe, unless ImageMagick stores some private data in the jpg (so this might not work with other packages). – harrymc Oct 29 at 20:37
Interesting. I'll wait to see how this pans out. – Nathaniel Oct 29 at 21:10
+1 Yes imagemagick works. I can repeatedly change the jpeg quality and use identify to see the change. This works if I use convert (another imagemagick untility) or another tool like MS Photo Editor. – DaveParillo Oct 29 at 22:20
vote up 1 vote down

To add to Arjan's answer:

ImageMagick's identify appears to actually look inside the JPEG image to guess the quality setting used to encode it.

ImageMagick's source code (cheer for free software :-)) contains the lines:

/*
  Determine the JPEG compression quality from the quantization tables.
*/
sum=0;
for (i=0; i < NUM_QUANT_TBLS; i++)
{
  if (jpeg_info.quant_tbl_ptrs[i] != NULL)
    for (j=0; j < DCTSIZE2; j++)
      sum+=jpeg_info.quant_tbl_ptrs[i]->quantval[j];

(coders/jpeg.c, line 843ff. in my recent version of ImageMagick's source code).

I don't know enough about JPEG to really understand, but it appears to do something like described in this article:

Determine the JPEG quality factor by using Visual C# .NET

http://support.microsoft.com/?scid=kb%3Ben-us%3B324790&x=16&y=6

So yes, identify can actually determine the quality setting of a JPEG just from the compressed file alone (though the result may not always be completely accurate).

link|flag
Whoa. Very nice of you to check the source code. Cool. – Nathaniel Jan 4 at 20:17

Your Answer

Get an OpenID
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.