2010.04.26 20:12 "Re: [Tiff] Bug in tif_print.c for TIFFTAG_REFERENCEBLACKWHITE", by Edward Lam
Edward Lam wrote:
> I have an 6-Bit RGBA image and using tiffinfo on it gives:
Er, I meant 8-bit here of course.
I also noticed another problem with the number of expected floats for TIFFTAG_REFERENCEBLACKWHITE in the documentation for TIFFSetField:
where it says:
This is a repost from awhile back that got no reply which still looks
like it exists in CVS HEAD. Again, I'd log it in the bug database except
that I can't seem to currently access remotesensing.org at all.
I have an 6-Bit RGBA image and using tiffinfo on it gives:
$ ./tiffinfo c:/cygwin/tmp/foo.tiff
TIFF Directory at offset 0x92c3c (601148)
Image Width: 512 Image Length: 512
Resolution: 1, 1 (unitless)
Position: 0, 0
Sample Format: IEEE floating point
Compression Scheme: LZW
Photometric Interpretation: RGB color
Extra Samples: 1<assoc-alpha>
Orientation: row 0 top, col 0 lhs
Planar Configuration: single image plane
DateTime: 2008:02:06 13:29:39
0: 0 1
1: 0 1
2: 0 1
3: 2.9389e-039 1.10203e-038
Notice that for the Reference Black/White entry, there's garbage printed
out in the last pair. According to page 87 of the TIFF6.pdf, the
ReferenceBlackWhite tag contains 6 rationals (or 3 pairs). tiffinfo
however is display 4 pairs.
I tracked this down to tif_print.c where we have code like this:
fprintf(fd, " Reference Black/White:\n");
for (i = 0; i < td->td_samplesperpixel; i++)
fprintf(fd, " %2d: %5g %5g\n", i,
Notice that i loops from 0 to td_samplesperpixel when I think it should
be looping from 0 to *3* instead. We similarly hardcode this constant
for this tag in other places.
One might think that perhaps the SamplesPerPixel tag should be 3 for
RGBA images but I think the TIFF 6 spec clearly says that
SamplesPerPixel *includes* ExtraSamples in the description for
ExtraSamples (page 31) as well as the note about it on page 27.