2003.09.17 22:26 "[Tiff] libtiff and CCITT4", by Jedidja Bourgeois

2003.09.17 22:26 "[Tiff] libtiff and CCITT4", by Jedidja Bourgeois

Hi

I'm trying to encode a one bit image using CCITT4 compression and getting rather strange results. The resulting file is viewable in Irfanview and Word, but in Windows Imaging Viewer it appears inverted. Also, I've noticed that the 'fax' tags don't show up in explorer's properties tab. The code I'm using follows:

TIFFSetField(m_tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); // single image plane
TIFFSetField(m_tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(m_tif, TIFFTAG_ROWSPERSTRIP, 1);
TIFFSetField(m_tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
TIFFSetField(m_tif, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX3);
TIFFSetField(m_tif, TIFFTAG_SAMPLESPERPIXEL, 1);
TIFFSetField(m_tif, TIFFTAG_BITSPERSAMPLE, 1);
TIFFSetField(m_tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
TIFFSetField(m_tif, TIFFTAG_SMINSAMPLEVALUE, 0);
TIFFSetField(m_tif, TIFFTAG_SMAXSAMPLEVALUE, 1);
TIFFSetField(m_tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_NONE);
TIFFSetField(m_tif, TIFFTAG_XRESOLUTION, 1);
TIFFSetField(m_tif, TIFFTAG_YRESOLUTION, 1);

Note that if I export an RGB tiff file at 8 bits per sample, the image appears correctly in every application. Does anyone have suggestions/hints?

Thanks,
Jedidja