2000.10.05 04:37 "Re: Varying BitsPerSample", by Frank Warmerdam
There was a discussion on a newsgroup recently about having TIFF files with different data formats per channel. For example, 8-bit RGB with a 32-bit Z channel. Some thought that the TIFF format does not allow this but then Derek Kusiak wrote:
> Unless I'm misunderstanding what the TIFF 6.0 spec says, that's not > true:
> "Note that this field [BitsPerSample] allows a different number of bits > per component for each component corresponding to a pixel. For example,
> RGB color data could use a different number of bits per component for > each of the three color planes." (p.29)
Is there a limitation in libtiff that prevents exploitation of this section of the spec?
I'm interested in interpretations of the spec, pros/cons of this feature, limitations and workarounds.
I didn't trace this through completely, but my quick read of the situation is that the TIFFDirectory structure only has a single element for BITSPERSAMPLE, SAMPLEFORMAT, MINSAMPLEVALUE and MAXSAMPLEVALUE, all of which should be per-sample, not singular. The writing interface seems to duplicate this number out to the number of samples, and the reading interface seems to work whether there is one or more values, but just captures the first into the TIFFDirectory.
I would really like to see some of these (in particular the MINSAMPLEVALUE and MAXSAMPLEVALUE) handled on a per-sample in libtiff. It would also be nice if the types of each sample could be controlled, though I think this would result in datasets that work properly with very few packages. It might be quite difficult to even get the libtiff tools programs to support this fully.
In short, I am willing to work with you to make libtiff handle this better, but I think it unwise to generate files like this if you actually want them to work with any other software.
I too would be interested in more educated opinions.
I set the clouds in motion - turn up | Frank Warmerdam, email@example.com
light and sound - activate the windows | http://members.home.com/warmerda
and watch the world go round - Rush | Geospatial Programmer for Rent