can't estimate the jpeg quality

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Posts: 1
Joined: 2019-12-11T03:36:36-07:00
Authentication code: 1152

can't estimate the jpeg quality

Post by sihafupi »

I've noticed that imagemagick can't estimate the jpeg quality from a camera that I have.
Quality 0-30 works fine, but as soon as I go above 30, I get nothing from imagemagick

Code: Select all

$ identify -verbose image30.jpg | grep -i quality
  Quality: 53
$ identify -verbose image32.jpg | grep -i quality
It seems to be caused by this line: ... peg.c#L940
i doesn't reach 50. I tried Version: ImageMagick 6.9.7-4 as well as ImageMagick-7.0.8-35
Can someone help me understand what's going on here? Thanks ;)
Last edited by sihafupi on 2020-01-13T22:27:05-07:00, edited 1 time in total.

User avatar
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: can't estimate the jpeg quality

Post by fmw42 »

Is it your camera? Does exiftool display the correct quality? Post links to your images so the developers can test with them

User avatar
Posts: 313
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: can't estimate the jpeg quality

Post by whugemann »

The JPEG quality was not defined by the original JPEG standard. It was introduced only later by the Independent JPEG Group's code (IJG), setting the quality of the DQTs in the original JPEG standard to 50% and providing a scaling algorithm for the matrix elements.

Thus the JPEG quality can only be really estimated for JPEG images that stem from programs that use (or follow) IJG code for JPEG compression. For any other source, i.e. phot cameras, it's just a rough guess. IM uses the IJG DQTs.

IM's code is rather simple, summing the matrix elements up and comparing the result to the sums that would follow from the IJG code. If your camera uses some kind of scaling for the matrix elements, IM's guess will fail.

If you provide your original photographs, I could give a more detailed analysis by the use of JPEGsnoop.
Wolfgang Hugemann