2008.01.23 17:40 "[Tiff] tiff library and exif", by Jamie L. Finch

2008.02.15 14:57 "RE: [Tiff] bug? JPEGQUALITY seems not to be read correctly", by Ed Grissom

There is no place in the header for a "quality" setting. This is not something that is in the JPEG spec or the TIFF spec. What is in both specs is a quality table (q-table). This q-table is generated from the q-setting.

It is difficult to recreate the q-setting that was used to create a q-table.

ed grissom

-----Original Message-----

From: tiff-bounces@lists.maptools.org [mailto:tiff-bounces@lists.maptools.org] On Behalf Of jcupitt@gmail.com

I think I might have found a bug (or misfeature) in JPEG quality handling.

If I write a file with TIFFTAG_JPEGQUALITY set to 100, it seems to work:

john@mm-jcupitt2:~/pics$ im_copy healthygirl.jpg test.tif:jpeg:100
john@mm-jcupitt2:~/pics$ im_copy healthygirl.jpg test2.tif:jpeg:75
john@mm-jcupitt2:~/pics$ ls -l test*
-rw-r--r-- 1 john john 643587 2008-02-15 14:29 test2.tif
-rw-r--r-- 1 john john 2267003 2008-02-15 14:29 test.tif

So we get a much larger file, as expected. But if I look at the files with tiffinfo, the TIFFTAG_JPEGQUALITY tag is not displayed:

john@mm-jcupitt2:~/pics$ tiffinfo test.tif

TIFF Directory at offset 0x2291ae (2265518)
    Image Width: 1166 Image Length: 1944
    Resolution: 118.11, 118.11 pixels/cm
    Bits/Sample: 8
    Compression Scheme: JPEG
    Photometric Interpretation: RGB color

  YCbCr Subsampling: 2, 2

Orientation: row 0 top, col 0 lhs

  Samples/Pixel: 3
  Rows/Strip: 16

Planar Configuration: single image plane

  JPEG Tables: (289 bytes)

and if I copy the file, quality seems to revert to the default (75):

john@mm-jcupitt2:~/pics$ tiffcp test.tif test3.tif
john@mm-jcupitt2:~/pics$ ls -l test*.tif
-rw-r--r-- 1 john john 643587 2008-02-15 14:29 test2.tif
-rw-r--r-- 1 john john 244444 2008-02-15 14:30 test3.tif
-rw-r--r-- 1 john john 2267003 2008-02-15 14:29 test.tif

So it seems that TIFFTAG_JPEGQUALITY is either not being written, or that on reading it is always set to the default 75. This is with libtiff 3.8.2.