AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

1994.02.17 16:23 "Fax images gets inverted (sometimes)", by Soren Pingel Dalsgaard
1994.02.17 04:14 "Re: Fax images gets inverted (sometimes)", by Richard Minner
1994.02.18 09:21 "Re: Fax images gets inverted (sometimes)", by Karsten Spang
1994.02.17 16:24 "fax inverted (cont.)", by Soren Pingel Dalsgaard
1994.02.18 09:03 "Re: Fax images gets inverted (sometimes)", by Karsten Spang
1994.02.18 15:44 "inverted fax", by Soren Pingel Dalsgaard

1994.02.17 04:14 "Re: Fax images gets inverted (sometimes)", by Richard Minner

The problem, as I see it, is the definition of fax compression. It tells the implementor how to encode 'white' and 'black' pixels. But Photometric Interpretation has nothing to do with how to compress the image and nothing to do with inverting the image before writing it. Fax compression should instead mention how to encode 0 pixels (white) and 1 pixels (black).

Maybe this should be addressed to the TIFF document maintainers (I'll have to look up their address in the TIFF 6.0 paper).

Blech. I was going to just say that libtiff is fine, and I would still like to think that, but TIFF 6.0 has some odd wording. First, the reason I prefer libtiff's behavior is that the fax encoding indeed deals with _white_ and _black_ pixels, not 0's or 1's. It is better to think of the "raw" image as a series of 'w's and 'b's. For example, code word '1000' represents 'www', not '000' or '111'. The PhotometricInterpretation should only come into play when translating 'www' to uncompressed raster bits, at which point you get either '000' or '111', each of which would still mean "3 white pixels". This makes sense because the CCITT encoding is optimized for "black marks on white paper". That is, if the page is mostly black it doesn't work as well. (Basically, the white-run codes are smaller than the black-run codes.)

BUT, TIFF 6.0, page 44, in italics at the bottom, says:

        An encoded CCITT string is self-photometric... we adopt
        the following convention:

        The "normal" PhotometricInterpretation for bilevel CCITT
        compressed data is WhiteIsZero. In this case, the CCITT "white"
        runs are to be interpretted as white, and the CCITT "black"
        runs are to be interpretted as black. However, if the
        PhotometricInterpretation is BlackIsZero, the TIFF reader
        must reverse the meaning of white and black when displaying
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        and printing the image.

I find the underlined phrase terribly vague, but it seems to imply that "white" runs should be displayed as black with BlackIsZero. That is, code '1000' --> 'www' --> '000' --> 3 black pixels. Ick.

Sam?

--
Richard Minner rtm@island.com {uunet,sun,well}!island!rtm
Island Graphics Corporation Sacramento, CA (916) 736-1323