2004.10.21 04:43 "Re: [Tiff] the BitsPerSymbol tag", by Sachin Garg
On Wed, 20 Oct 2004 15:51:36 -0400, Frank Warmerdam <email@example.com> wrote:
>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?
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.
ed grissom, frank,
I am actually using the read/write buffer routines from tiffcp. Do these routines return a padded version of image data as described by you above (with pad size determinable from single td_bitspersample value)?
Also, Is there some way detecting this?
So that I can return "unsupported" from my application for such images.
(because if I do a read+write of such an image using libtiff+tiffcp, i will probably end up with a tiff image which as different specifications than the image I started with, which is unacceptable for my application)
Sachin Garg [India]