Re: jpeg quality factor.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
factor.

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
tables.

The website
http://www.impulseadventure.com/photo/jpeg-quantization.html seems to
have a good collection and comparison of quantization tables used by
different firmware and software implementations of JPEG compression.

http://markcox.googlecode.com/svn/trunk/jpegdump/jpegdump/ 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
http://www.programmersheaven.com/download/17054/download.aspx 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.

--tml

_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux