2005.03.10 10:46 "[Tiff] libtiff: Tiff Tag EXTRASAMPLES and TIFFRGBAImage", by Daniel Sievers

2005.03.10 10:46 "[Tiff] libtiff: Tiff Tag EXTRASAMPLES and TIFFRGBAImage", by Daniel Sievers

Hi,

I have two related libtiff concerns:

1) Reading TIFF images with the nice TIFFReadRGBAImage() routine

(version of libtiff used is 3.7.1 )

in line 250 of tif_getimage.c it says: "if (extrasamples > 1)"

That way img->alpha is always left set to 0 for images with extrasamples==1 (which I assume is the common case). Then alpha values from the image are not used, but initialized to 0xff.

Shouldn't it say "if (extrasamples > 0)"?

~From what I can see with common code samples and RGB images, these have a value of extrasamples==1, if they contain an alpha channel.

2) About using the get and set routines for the EXTRASAMPLES flag

The official TIFF homepage lists http://www.awaresystems.be/imaging/tiff/faq.html as a reference for TIFF tags. On that page EXTRASAMPLES is defined differently from how it is used. There it says for the baseline EXTRASAMPLES tag, that this tag consists of N values, where N=samplesPerPixel-colorSamples. How it is really used is that it returns N+1 values. The first value returns the number of extrasamples, while the remaining values work as documented.

Or do tags with more than one value generally work this way? Is there any clear documentation on this somewhere?

I would appreciate comments on this, especially the first matter.

Thanks!

- -Daniel