2004.05.28 17:32 "Re: [Tiff] Tiff JPEG compression quality factor", by Phillip Crews
I'm using the libtiff v3.6.1 and I can save a tiff file with Jpeg >compression and quality factor 80, but when i
>try to open it, the jpeg quality factor pseudotag has a value of 75. I >guess I am doing something wrong, >because I assume that I can read the Jpeg quality factor written in
>>advance. Is that correct?
Not that I am too knowledgable about this particular area, but my understanding is that the quality "pseudotag" is not really saved with the data. It is just used to drive the compressor. So, when you read a TIFF the value isn't derived from the file, but just set to an initial default value (75).
In short, I don't think you can read the quality factor from an existing image.
I believe Tom Lane provided this method of estimating the Q Factor of a JPEG. It is relatively accurate for images saved using the IJG library:
int q = cinfo.quant_tbl_ptrs->quantval;
if (q > 51)
q = (50 * 51 + q / 2) / q;
q = (5126 - 50 * q) / 51;