Guillermo Espertino writes:
 > I didn't know that PS compression scale doesn't follow the jpeg 
 > specification.

There is no such specification for a compression scale or quality

Inside an JPEG image, what actually defines the lossiness of the
compression are a set of so-called "quantization tables". A
quantization table is a table of 64 8- or 16-bit integers. (Typically
8-bit values are used.)

Typically, one such table is used for the "Y" channel (luminance,
i.e. "B&W" information) and another for the Cb and Cr channels (colour
information). These tables are actually stored inside each JPEG image.

(There are not some standard one(s) that would implicitly be
referenced to by some single index that would say "use standard table
1" or something like that. In retrospect, that might have been a good
idea I think.)

I.e. what actually determines the lossiness and "loss style" of the
compression, what information is thrown away, are 128 (or just 64, or
even 192) numbers (!). Not a single quality value.

(It is in fact even possible to use different quantization tables for
different parts of an image, I think. I have no idea how common such
JPEG images are, and if any software in common use produces such.)

The single quality value 1..100 that GIMP uses is passed to libjpeg's
jpeg_set_quality() function. This function is used to scale two sample
quantization tables given in the JPEG specification. But nothing
forces some application to use linear scalings of these sample
quantization tables. I don't know if the sample tables are even
normative in the standard, or just informative.

One might imagine some application even doing a clever analysis of an
individual image to come up with image-specific quantization

The website seems to
have a good collection and comparison of quantization tables used by
different firmware and software implementations of JPEG compression. has sources
to a nice program one can dump the contents of a JPEG file, if one
wants to have a look at the quantization tables used.

There is another program with the same name at that is
less useful in general, but has one nice feature: it attempts a guess
at the libjpeg-style quality factor used for the quantization tables.


Gimp-developer mailing list

Reply via email to