mozilla / mozjpeg

Improved JPEG encoder.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does Mozjpeg record luminance and chrominance compression qualities in JPEG file ?

zeroheure opened this issue · comments

As I understand it, the JPEG quality is recorded in the file, even if it is not useful. But how does Mozjpeg record luminance and chrominance compression qualities in JPEG file ? Looks like there is a problem. But I don't have enough C coding skills to understand.

Take a common JPEG file (common.jpg), not recorded with Mozjpeg. Let's run Mozjpeg on this file with one quality param (commnon-moz1.jpg) then with two quality params for luminance and chrominance (common-moz2.jpg).

Now run ImageMagick's identify -verbose on each file. Here's excerpt of the output :

common.jpg

Compression: JPEG
Quality: 75
Orientation: Undefined

common-moz1.jpg

Compression: JPEG
Quality: 75
Orientation: Undefined

common-moz2.jpg

Compression: JPEG
Orientation: Undefined

Nothing about quality, while I was expecting something like

Quality: 75,20

Sorry, I think I misunderstood JPEG format. Quality is never recorded. It is guessed by some softwares after content analysis.

Right, ImageMagick's quality guess assumes you use the old libjpeg-turbo, and gives a pretty bad result for anything else.

The quality can be recovered pretty reliably by analyzing quantization tables stored in the file, but you need to compare to tables used by the encoder.

Thanks for the clarifiation.