AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2005.04.28 13:40 "[Tiff] Delphi 7, TIFF G3/4, Multipage", by Matthias Lach
2005.04.29 16:09 "Re: [Tiff] Delphi 7, TIFF G3/4, Multipage", by Joris
2005.05.02 16:12 "RE: [Tiff] Color TIFF/JPEG compression questions", by Frank, Jason
2005.05.02 13:44 "RE: [Tiff] Color TIFF/JPEG compression questions", by Grissom, Ed
2005.05.02 14:16 "Re: [Tiff] Color TIFF/JPEG compression questions", by Joris
2005.05.02 16:29 "RE: [Tiff] Color TIFF/JPEG compression questions", by Frank, Jason
2005.05.02 17:55 "Re: [Tiff] Color TIFF/JPEG compression questions", by Joris
2005.05.02 18:17 "RE: [Tiff] Color TIFF/JPEG compression questions", by Frank, Jason

2005.05.02 18:17 "RE: [Tiff] Color TIFF/JPEG compression questions", by Frank, Jason

Thanks for the schooling. That shiny new JPEG compression scheme is really quite clever. I've taken a look at the code for tif_print.c, and it looks correct. It goes like this:

        if (TIFFFieldSet(tif,FIELD_YCBCRSUBSAMPLING))
        {
            /*

             * structures.
             */
            uint16 subsampling[2];

            TIFFGetField( tif, TIFFTAG_YCBCRSUBSAMPLING,
                          subsampling + 0, subsampling + 1 );
                fprintf(fd, " YCbCr Subsampling: %u, %u\n",
                        subsampling[0], subsampling[1] );
        }

I didn't find any redefinitions of TIFFTAG_YCBCRSUBSAMPLING, and I didn't see any suspicious TiffSetFields in tiffinfo.c either. I did notice that tiffdump said:

YCbCrSubsampling (530) SHORT (3) 2<2 2>

On the very last line.

So, I think that tiffinfo might be playing correctly here (since it agrees with tiffdump, and I don't see any obvious problems with the code.)

Jason

-----Original Message-----
From: Joris [mailto:joris.at.lebbeke@skynet.be]
Sent: Monday, May 02, 2005 12:56 PM

To: Frank, Jason; tiff@remotesensing.org Subject: Re: [Tiff] Color TIFF/JPEG compression questions

tiff2rgba -c jpeg -r 16 quad-jpeg.tif quad-jpeg-rgb.tif

This gave me a file with the following tags:

tiffinfo quad-jpeg-rgb.tif
TIFF Directory at offset 0xdb28
  Image Width: 512 Image Length: 384
  Bits/Sample: 8
  Compression Scheme: JPEG
  Photometric Interpretation: RGB color
  Extra Samples: 1<assoc-alpha>
  YCbCr Subsampling: 2, 2
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 4
  Rows/Strip: 16
  Planar Configuration: single image plane
  Software: LIBTIFF, Version 3.7.2
Copyright (c) 1988-1996 Sam Leffler
Copyright (c) 1991-1996 Silicon Graphics, Inc.
  JPEG Tables: (289 bytes)

tiff2rgba most certainly produces a buggy image here.

My source image has these tags:
TIFF Directory at offset 0x5b6e
  Image Width: 512 Image Length: 384
  Position: 0, 0
  Bits/Sample: 8
  Compression Scheme: JPEG
  Photometric Interpretation: YCbCr
  YCbCr Subsampling: 2, 2
  Samples/Pixel: 3
  Rows/Strip: 16
  Planar Configuration: single image plane
  Reference Black/White:

     0:     0   255
     1:   128   255
     2:   128   255
  JPEG Tables: (574 bytes)

Interestingly, the tagdump produced by AsTiffTagViewer is slightly different:

ImageWidth (1 Short): 512
ImageLength (1 Short): 384
BitsPerSample (3 Short): 8, 8, 8
Compression (1 Short): JPEG Technote #2
Photometric (1 Short): YCbCr

StripOffsets (24 Long): 8, 175, 342, 633, 2227, 3683, 5112, 6553,... SamplesPerPixel (1 Short): 3

RowsPerStrip (1 Short): 16

StripByteCounts (24 Long): 167, 167, 291, 1594, 1456, 1429, 1441, 1114,... PlanarConfig (1 Short): Contig

XPosition (1 Rational): 0
YPosition (1 Rational): 0
JpegTables (574 Undefined):

ReferenceBlackWhite (6 Rational):

There's no YCbCrSubsampling tag here. Thus, tiffinfo clearly brings defaults into the picture, which is not ideal when the purpose is discovering what tags are there.

It looks like tiff2rgba retained the YCbCr field. And, for some


source file has JPEG Tables, which I thought were used reason the

> under Type 6 compressions. I don't know if that's expected, but I > thought I'd pass it on.