AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2005.06.20 10:19 "[Tiff] Invert-problem", by Matthias Lach
2005.06.20 11:47 "Re: [Tiff] Invert-problem", by Michel Salvagniac
2005.06.20 15:52 "Re: [Tiff] Invert-problem", by Bob Friesenhahn

2005.06.20 10:19 "[Tiff] Invert-problem", by Matthias Lach

Hello All,

ist me again - and i have still a problem saving my file.

i opend a fax g-3 tiff with LibTif for Delphi (D7).

I open it as 32 bit bitmap and can work and manipulate it if i like ot save it i need to convert it back into 1-bit because all other formats make the outputfile looks jolted.

But - no matter what bit-format i choose, all output is invertet - and i cant find the reason why. i got a tip from Michel Salvagniac - but it does not work for me.

"
--
maybe the resolution is faulty... ; )

I had to invert black and white (i don't understand why...) like that:

      TmpBMP.Height := BMP.Height;
      TmpBMP.Width :=BMP.Width ;
     if TmpBMP.width mod 8 <> 0 then bm:= (TmpBMP.width div 8)
                           else bm := (TmpBMP.width div 8) -1;
    FOR j := 0 TO TmpBMP.Height-1 DO
    BEGIN

      RowOut := pByteArray(TmpBMP.Scanline[j]);
      RowIn  := pByteArray(BMP.Scanline[j]);

      FOR i := 0 TO bm DO
      BEGIN
        RowOut[i] := NOT RowIn[i]
      END
    END;

you will need some var's:
   RowIn :  pByteArray;
   RowOut:  pByteArray;

bm: integer;
don't forget to create TmpBMP...
--
"

---
Mit freundlichen Gruessen

Matthias Lach