How to find out jpeg quality of a read image using graphicsmagick
when i read jpeg image using Magick :: readImages (...) function. how can i find out the approximate jpeg image quality? I know how to set the quality when I want to record an image, but it has nothing to do with the quality of the original image, for example: when I read a jpeg image, its quality is 80% and I write it using 90% quality. I get a larger image than the original as 90% is not 90% of the original 80%. How do I know the jpeg quality for a read image?
a source to share
This is not possible, period. JPEG quality settings are simply a number that is passed to the encoder and affects how the encoder processes the data.
It's not even a percentage of everything - it's just some setting that affects how aggressively the encoder manipulates and transforms the data. Wherever you see a percent sign that is close to JPEG quality, just ignore it - it's pointless.
Therefore, regardless of the encoder, it is impossible to determine which JPEG quality settings are used to use this very image. The only way is to get the original and try all reasonably possible settings until you get the same result.
a source to share
It is possible, but difficult. The code should validate the image the same way people do. Here's a related article http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.4.4621&rep=rep1&type=pdf
a source to share
Not hard or hard with GraphicsMagick (or ImageMagick). A type
gm convert -log% e -debug coder in.jpg junk.ppm
and look at the output for the line
Quality: nn
if the image was created by the Independent JPEG Group or
Quality: nn (approximate)
otherwise.
You can also use
gm define -verbose in.png
and see
Quality: nn
lines; however, this does not distinguish between exact and approximate qualities.
a source to share