2004.04.02 14:05 "[Tiff] 16 bit gray scale images and tiff", by Wendel Dean Renner

2004.04.02 14:05 "[Tiff] 16 bit gray scale images and tiff", by Wendel Dean Renner

The TIFF 6.0 Specification, on page 22, says "Allowable values for Baseline TIFF grayscale images are 4 and 8, allowing either 16 or 256 distinct shades of gray." Maybe the problem here is the word "Baseline". I don't know what that means. Where in that document is 16 bits per sample allowed?

In any event I posted a message last week because I could not understand how film scanners could be writing 16 bit gray scale images in TIFF format (for x-ray film which is black and white), or how I could read those images.

I want to thank the two people who replied to me. To read a 16 bit gray scale I was told to call TIFFReadScanline in the TIFF library, and that works. For each pixel the first byte was the most significant byte.

Do I assume that all images are of this byte order? In the GraphicMagick stuff I downloaded I found a call to MSBOrderShort that has something to do with byte order, but I don't know what that function does, nor could I find it in either GraphicMagick (but it must be there somewhere) or in the tiff library.

Another question, is there such a thing as an RGB image with 16 bits per sample (and so 3 samples per pixel)? What happens when a 14 bit scanner writes out a color image? Are they truncated to 8 bits per color? I notice in the TIFF library that TIFFGetR, TIFFGetB and TIFFGetG assume RGB is 3 bytes, blue the most significant byte, and so byte order is also assumed besides the size of each sample.

Lastly, I have a 16 bit TIFF gray scale image file written by Adobe PhotoShop that someone sent me, that TIFFOpen bombs on every time (I mean the program crashes upon calling TIFFOpen passing in the file name as an argument). Yet the image displays OK if I use some other image viewing software. But I have yet another 16 bit gray scale image from PhotoShop.that gets past TIFFOpen and I can read and display the image. I am using a Windows libtiff that I down loaded (I can't remember if it was from your site or someplace else). (I also run under Linux and have not tried it there yet.)

I do not receive the list as I am not a member so I would apperciate any response be copied to my email address wendeldrenner@comcast.net. I have written an application where I have to be able to read TIFF encoded images.

It would be nice in my opinion if the film scanner people would also write to PNG format.