AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2019.12.09 20:19 "[Tiff] help writing RGB TIFF", by Paul Hemmer
2019.12.09 20:55 "Re: [Tiff] help writing RGB TIFF", by Bob Friesenhahn
2019.12.09 21:06 "Re: [Tiff] help writing RGB TIFF", by Paul Hemmer
2019.12.09 21:31 "Re: [Tiff] help writing RGB TIFF", by Bob Friesenhahn
2019.12.09 21:40 "Re: [Tiff] help writing RGB TIFF", by Paul Hemmer
2019.12.09 21:58 "Re: [Tiff] help writing RGB TIFF", by Bob Friesenhahn
2019.12.10 01:33 "Re: [Tiff] help writing RGB TIFF", by Paul Hemmer
2019.12.09 21:07 "Re: [Tiff] help writing RGB TIFF", by Yakov Galka
2019.12.09 21:12 "Re: [Tiff] help writing RGB TIFF", by Paul Hemmer
2019.12.09 21:13 "Re: [Tiff] help writing RGB TIFF", by Yakov Galka

2019.12.09 20:19 "[Tiff] help writing RGB TIFF", by Paul Hemmer

Hi,

I'm combining two 16bit grayscale images into a single RGB image (using OpenCV) to do the combination and coloring, but using LibTIFF to save it.

If I use OpenCV's imwrite function (which uses LibTIFF internally) and open the resulting TIFF file in ImageJ, it looks correct and is treated as an RGB image (info shows isRGB=true).. That is, ImageJ does not try to present 3 separate channels.

If instead I use LibTIFF and save it (using relevant fields below, note it is a tiled-tiff), and open the image in ImageJ, it looks correct (takes longer to open) but ImageJ seems to treat it as 3 independent channels and when I look at the image info, it shows isRGB=false.

What do I have to include or change to treat this as a simple RGB image?

Thanks!

TIFFSetField(tiff_handle, TIFFTAG_BITSPERSAMPLE, 8);

TIFFSetField(tiff_handle, TIFFTAG_COMPRESSION, COMPRESSION_NONE);

TIFFSetField(tiff_handle, TIFFTAG_SAMPLESPERPIXEL, samples_per_pixel);

TIFFSetField(tiff_handle, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);

TIFFSetField(tiff_handle, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);

TIFFSetField(tiff_handle, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);

TIFFSetField(tiff_handle, TIFFTAG_TILEWIDTH, 256);

TIFFSetField(tiff_handle, TIFFTAG_TILELENGTH, 256);

TIFFSetField(tiff_handle, TIFFTAG_RESOLUTIONUNIT, 3);

TIFFSetField(tiff_handle, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);