c++imagegraphicsmagick

How can I know the jpeg quality of the read image using graphicsmagick


When I read a jpeg image using Magick::readImages(...) function. How can I know the estimated jpeg quality of the image? I know how to set the quality when I wanna write the image, but it is not relevant to the quality of the original image, so for example: when I read a jpeg image that its quality is 80% and I write it using 90% quality I will get a bigger image than the original one, since the 90% is not 90% out of the original 80%. How can I know the jpeg quality of the read image?


Solution

  • This is impossible, period. The JPEG quality settings is just a number that is passed to the encoder and affects how the encoder treats the data.

    It's not even percentage of anything - it is just some setting that affects how aggressively the encoder manipulates and transforms data. Wherever you see the percent sign near JPEG quality just ignore it - it's meaningless there.

    So regardless of the encoder it is impossible to find which JPEG quality settings value the enocder used to produce this very image. The only way would be to obtain the original and try all reasonably possible setting values until you hit the same result.