TIFF and LibTiff Mail List Archive


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.18 15:44 "inverted fax", by Soren Pingel Dalsgaard


People have pointed out that I should read page 50 in the tiff spec, but that is exactly the reason for my posting in the first place.

PhotometricInterpretation has been defined so that you can negate an image simply by changing its value. If you agree on this, raise your hand read on :-)

First I take an image and save it using fax compression. Next I negates every pixel in the image and changes PhotometricInterpretation andsave it into another file. If I compare these files byte by byte I find the only difference to be PhotometricInterpretation. This should signal that one picture is the negative of the other, but I changed *BOTH* the bits *AND* PhotometricInterpretation, so it should be the same image.


Some people have poited out that white runs compress better than black runs. I know that this is the case (I have been working with the tiff spec. for approx. 4 years by now), but the compression method should not change the data being compressed. If you still think that fax compression should change the interpretation of white and black to compress better, then why not skip No-compression and use LZW or Packbits instead. In most cases this works better. NO! The compression scheme should only compress the bits (without considering how bits are interpreted as colors). If you use a GrayResponseCurve the compression scheme should not lookup bytes before compressing.

If fax is not suited for your bilevel/lineart image, negate it bit by bit or select another compression scheme. By the way, Fax4 doesn't seem to compress any worse on negated images because it is a two dimensional compression scheme. I got two bytes difference (probably from the first scanline being all black instead of white).


My private copy of libtiff will not have fax compression that consults PhotometricInterpretation in order to compress fax images.

By the way:

Referring to black and white in fax compression would be the same as describing how to compress dark bytes and bright bytes. You have to leave the colors behind when describing a compression scheme. Fax machines use WHITE==0 and BLACK==1 therefore black and white in a description of fax compression makes sense -- FOR FAX MACHINES. when the same method is used in TIFF the right hand side should be used and 0's and 1's should be compressed.

And, yes, it took a long time for me to realise what went wrong...


Soren Pingel Dalsgaard
Department of Computer Science
Aarhus University
Ny Munkegade 116
DK-8000 Aarhus C