开发者

Detecting bits per pixel in a TIFF image

开发者 https://www.devze.com 2023-01-19 06:09 出处:网络
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 imag

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消