2004.10.20 18:40 "[Tiff] the BitsPerSymbol tag", by Sachin Garg

2004.10.20 19:51 "Re: [Tiff] the BitsPerSymbol tag", by Frank Warmerdam

>From the Tiff6 documentation, it seems that a tiff image is supposed to have a BitsPerSymbol value for each sample in the image.

But from TiffDirectory implementation, it seems that we hold a single "uint16 td_bitspersample" value for all samples.

Is it that all samples always have same bit-depth? it doesnt seems that way for documentation, for example it says that a 16-bit image usally has 5/6/5 bits per sample.

I also noticed a "uint16* td_sampleinfo;" in TiffDirectory, is it something related to this?

Sachin,

In theory the TIFF specification supports having samples in a TIFF file with different bit depths. In practice this is quite uncommon. The TIFF format does indeed store a value for each sample; however, there was a deliberate decision within libtiff support to only support images with all samples of the same type. This is why the td_bitspersample is a single scalar value.

Indeed, 16bit video cards are normally using 5/6/5 bits per plane for red, green and blue. Unfortunately, libtiff cannot read and write TIFF files configured this way, though you can easily read and write the data as 24bit by padding out each of the samples to 8bit.

Best regards,

---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent