2009.05.19 12:32 "[Tiff] Heap corruption caused by TIFFRGBAImageGet() + TIFFSetDirectory() + TIFFRewriteDirectory()", by

2009.06.16 19:23 "Re: [Tiff] Tiff 16 bit and 32 bit images + some more questions about tiff file format", by Bob Friesenhahn

For bi-level image, we need only 2 bits (1 black, 0 white or vice-versa). But, I have seen tiff images where bps is not only 1 but it varies from 1 to 64. Why do we have so many extra bits, what are they needed for?

It is possible for a black/white image to consume more than 2 bits because it originates from images with more bits, or is commonly used in conjunction with images with more bits, or because it is processed by software which is designed for more bits. For example, if the image was a frame from a movie, a black/white image which occurs in a color movie would likely use the same format as the color frames.

And, sometimes, sampleformat is unsigned/signed integer and even float( i have tiff float bi-level sample image), what does this float and negative samples mean for bi-level, also for greyscale, RGB images? If we have palette image, doesnt it mean that pixel value is infact index to color map or color lookup table (dont know the exact term), but what will happen in float, signed case? I am very confused in this question.

I have never encountered a TIFF file which uses signed ints. Some computer languages (e.g. Ada and BASIC) do not support native unsigned types. Regardless, integer TIFF files seem to all use unsigned values. Negative values might be meaningless for a float image, but they might also serve some purpose. If negative values don't provide value to your software, then you can clip them to zero. It does not make sense to index a colormap using a float value so I would intentionally reject that case.

Colors in RGB images have fixed set of values for R,G,B. Colors for palette images have color map. Bi-level images are only black/white.

How is color determined(not actually color but grey-scale shades) in grey-scale images??

This is an area worthy of more investigation since gray is very important. Light sensors like CCDs produce values based on the amount of actual light ("linear light"). Images used for 3D renderings and 2D composition often use linear light. Normal computer displays ("sRGB") and TVs ("Rec.709") use "linear intensity" ("luma") in which the values are adjusted based on a gamma curve so that each step is linear in terms of human perception (human vision is not linear). The actual response of a device might not match any particular standard so an ICC color profile could be used to specify the ramp to be applied to the grayscale. Most computer images are similar to sRGB.

I need to handle tiff images that are spp = 1,3; bps = 1,8,16,32; signed/unsigned/float sample format; planar configuration contig; RGB with only 3 samples, alpha/extra channels not to be considered; how should I start differentiating all the possible images,a brief hint/guideline just to start....I would really appreciate that. Do I need to worry about photometric interpretation for this??

Feel free to study the TIFF readers in GraphicsMagick and other open source software. See http://cvs.graphicsmagick.org/cgi-bin/cvsweb.cgi/GraphicsMagick/coders/tiff.c for the GraphicsMagick implementation.

Bob
--
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/