2006.01.11 02:01 "[Tiff] help on reading a 16bits grayscle TIFF image", by NGUYEN QUANG BANG

2006.01.11 02:40 "Re: [Tiff] help on reading a 16bits grayscle TIFF image", by Bob Friesenhahn

I have a problem while reading a 16 bits grayscale TIFF image. when i use the function TIFFReadRGBAImage and TiffReadEncodedStrip, they give different results.

When i read this image using MatLab, it gives the image with the pixels have value RGB as result of TIFFReadRGBAImage,and the corresponding index as the result of TiffReadEncodedStrip function.

TIFFReadRGBAImage() is a higher level function than TiffReadEncodedStrip(). The TiffReadEncodedStrip() function returns the raw-uncompressed data from the TIFF. This data could be indexes into a colormap containing 16-bit RGB color samples. Or it could be raw gray samples. But TIFFReadRGBAImage() always represents the image as TrueColor RGB so it must used the indexes and the colormap (or the raw gray samples) to create the equivalent (or as close as possible) TrueColor RGB image. For your gray image, TIFFReadRGBAImage() needs to emulate the gray by using equal parts of red, green, and blue.

TIFFReadRGBAImage() is intended for casual libtiff users that don't have the time to deal with the many permutations of the TIFF format.

So what is your question?

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