Han开发者_StackOverflow社区dling monochrome tiff image using LibTiff, I can read "Bits per sample" parameter: TIFFTAG_BITSPERSAMPLE. When it returns 16, actual "Bits per pixel" value for such image may be any value from 9 to 16, in most cases this is 10, 12, 14 or 16. Is there any tiff image tag that keeps this value?
The MaxSampleValue tag will give you the maximum value of each sample (for the N samples making up each pixel), so you can use this, if it is present, to determine the number of bits needed to represent any sample value. This will be essentially ceil(log2(x)) where x is the MaxSampleValue tag value for a sample.
精彩评论