From: jason1@pobox.com (Jason Summers)
Date: Wed, 17 Sep 2003 18:40:02 -0500
Subject: [Tiff] libtiff and CCITT4
In-Reply-To: <Law9-OE47fdY6hlHK91000084d3@hotmail.com>
References: <Law9-OE47fdY6hlHK91000084d3@hotmail.com>
Message-ID: <3F68F0D2.2080407@pobox.com>

Jedidja Bourgeois wrote:
> 
> 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/


