2002.05.29 20:28 "question about getting "normalized" RGB data", by Bradley Flubacher

I'm using libgeotiff along with libtiff to extract a sub-section of a large GeoTIFF file. I've finally got it all working right. The end result is a texture-mapped terrain face. It looks pretty neat!

This is finally working, but I had to alter the libtiff code to make it do what I think it should be doing-

I have two test images. One is gray-scale (16 bit) and the other is RGB, 16-bits per component. However, the whole dynamic range is NOT being used! In other words, the maximum value is NOT 0xffff, but rather more like 0x1fff.

So, in order for the "put" function to work correctly (called through TIFFReadRGBAStrip), I had to find the maximum sample value (through the tag), and normalize each component by this value, then multiply the result by 0xffff. After doing this, dropping the least-significant bits leaves a good looking image. If I don't do this, the resultant image is basically BLACK because the MSB's don't carry much information at all!

Does this sound right to you?

Thanks in advance!

Brad