tags:

views:

25

answers:

1

Handling 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?

A: 

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.

ergosys
I see, it is called TIFFTAG_MAXSAMPLEVALUE in LibTiff. Is there any definition of this tag? I don't need actual maximal pixel value in an image, I need image format, which is usually parameter of detector where this image was acquired.
Alex Farber
http://www.awaresystems.be/imaging/tiff/tifftags/maxsamplevalue.html , or look in the latest tiff specification.
ergosys
Samples are only values, and well defined in the spec, so I'm not understanding the "parameter of detector" part of your comment. Perhaps if you gave an example in your question it might help me or someone else to understand.
ergosys