2005.02.15 15:40 "[Tiff] Regarding the decoding of uncompressed Big Endian RGB TIFF files.", by Chinku Miandad M

2005.02.15 16:57 "Re: [Tiff] Regarding the decoding of uncompressed Big Endian RGB TIFFfiles.", by Joris Van Damme

Chinku,

Bob wrote off-list:
> The poster is dealing with raw uncompressed TIFF files without the
> benefit of something like libtiff.

Ah, now I understand. Sorry I missed that.

The decoded image appears like a grayscale one. Also colored lines are appearing above the image. It seems like the image lines are getting corrupted slightly.

The colored lines at the top of the image are probably noisy, not showing any signs of being true image data, right? My guess is that you have an incorrect offset of the image data. Other then that, I cannot tell. Compare the offset your code is working with, with the offset as read by LibTiff, or shown by a Tag Viewer like http://www.awaresystems.be/imaging/tiff/astifftagviewer.html.

Do I need to do some swapping in the RGB data that I read from the image file? I am asking this since the file is of a big endian type.

The byte order should not matter as far as the actual image color data is concerned, since it's all 8bit data. Swapping issues only apply to 16bit and 32bit data (and 64bit data, in the new BigTIFF). There's no swapping of channels or such, RGB is supposed to always be R-G-B no matter what byteorder the TIFF file.

Thus, if you're not having the sample problem with little endian files, my guess is that you're probably not byteswapping **the strip or tile offset** correctly.

I think I am getting the luminance component correct. But it seems like there is some problems with the chrominance components since I am not getting the proper color.

Totally weird. There's no luminance/chrominance in RGB data. Must be another and unrelated bug, like e.g. taking the data from one single channel and using it for all of R, G, and B, or something. I'm only guessing, though.

BTW, thanks for changing to the clean nice plain text mail format!!

Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be/
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html