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

2003.09.17 23:40 "[Tiff] libtiff and CCITT4", by Jason Summers

> 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.

TIFFSetField(m_tif, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX3);

That looks like CCITT3, not 4. But either way it's the same issue:

TIFFSetField(m_tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);

If you want portability, you should use MINISWHITE with CCITT3/4 compression. The problem is that some applications ignore the PHOTOMETRIC setting in this case. Correctly-behaving applications will invert the image if PHOTOMETRIC=MINISBLACK, but that may have been ambiguous in some old versions of the TIFF specification.

MINISWHITE may also give you a better compression ratio, if your images are typical (mostly white).

Also, I've noticed that the 'fax' tags don't show up in explorer's properties tab.

Beats me.

Jason Summers
jason1@pobox.com http://entropymine.com/jason/