TIFF and LibTiff Mail List Archive


1997.05.05 18:19 "I have a little problem with CCITT compression", by Gabriela Vaida
1997.05.06 07:29 "Re: I have a little problem with CCITT compression", by Iñigo López

1997.05.06 07:29 "Re: I have a little problem with CCITT compression", by Iñigo López

My name is Gabriela Vaida and I'm using Libtiff version 3.4beta024 with WINNT40. It's a really great job there, thanks for sharing it.

But I'd like to know if it's my mistake or you know something about using CCITT compression.

I have this line in my code:


which really compress the tiff image I'm creating, but my image has always the colors inverted after compression. It doesn't matter if I choose the photometric interpretation PHOTOMETRIC_MINISBLACK or PHOTOMETRIC_MINISWHITE (the second one it's normal for CCITT compression, I know!). If I don't want commpression (COMPRESSION_NONE)my tiff image has the colors I want - the problem is there only when using CCITT compression.

Hi Gabriela,

I happened to have a similar problem some time ago. Some TIFF viewers wrongly assume that photometric interpretation for CCITT compressed images should be MINISWHITE, and they don't even check the TIFF tag. For example, Imaging for Windows by Wang (I guess these guys haven't read the TIFF spec!).

Anyway, you HAVE to set the photometric interpretation tag to the apropiate value (it is MINISBLACK, right?) and use a correct TIFF viewer. But if you want to use the same TIFF viewer, you will have to invert all the bits of your image and set the tag to MINISWHITE before writing the image. This should correct your problem and any viewer will display the image right.

This is what I do as I like the TIFF viewer developed by Wang, although I HATE to invert the bits of all the images everytime I do a scan. It is such a waste of time...


    O      Iñigo López Cía       
   o O     Fundesco - Dpto. Redes
  . o O    Plaza de la Independencia, 6    Tel: +34-1-3300735
   . o     28001 Madrid                    Fax: +34-1-3300675
    .      Spain