AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2010.06.24 22:21 "[Tiff] Problematic fax image", by Bratislav Stojanovic
2010.06.25 00:44 "Re: [Tiff] Problematic fax image", by Lee Howard
2010.06.25 14:17 "Re: [Tiff] Problematic fax image", by Bratislav Stojanovic

2010.06.25 00:44 "Re: [Tiff] Problematic fax image", by Lee Howard

I'm trying to decompress one CCITT G3 1-D image using libTIFF, and I simply don't know what might be the problem.

The explanation: I have a CCITT G3 1-D image inside a memory buffer. I'm using TIFFClientOpen & ReadEncodedStrip. It all works fine with one of the G3 images taken from the pics package, as well with some other G3 images I've tried. But for this one, it just won't work.

The library will report the following:

c:\Users\Bratislav\Documents\Visual Studio 2005\Projects\ccitt\Debug>ccitt.exe

BitAcc=00000000, BitsAvail = 0
-------------------- 0
Fax3Decode1D: Warning, dummy: Line length mismatch at line 0 of strip 0 (got 537
, expected 536).

BitAcc=0000053F, BitsAvail = 11
-------------------- 0
Fax3Decode1D: Warning, dummy: Premature EOL at line 1 of strip 0 (got 0, expecte
d 536).

BitAcc=00000000, BitsAvail = 1
-------------------- 0
Fax3Decode1D: Warning, dummy: Premature EOL at line 2 of strip 0 (got 20, expect
ed 536).

BitAcc=00000020, BitsAvail = 6
-------------------- 0
Fax3Decode1D: Warning, dummy: Premature EOL at line 3 of strip 0 (got 20, expect
ed 536).

BitAcc=00000020, BitsAvail = 6
-------------------- 0
Fax3Decode1D: Warning, dummy: Premature EOL at line 4 of strip 0 (got 4, expecte
d 536).

BitAcc=00000000, BitsAvail = 2
-------------------- 0
Fax3Decode1D: Warning, dummy: Premature EOL at line 5 of strip 0 (got 0, expecte
d 536).

Those are all warnings, but then the ReadEncodedStrip will return a number < 0, which means something is wrong, and the code will fail. BTW, the output is written into a PBM file (basically a small header + samples).

In the attachment you will find:

- simple console-based application used for decompression

- problematic image inside a separate file (this file will be loaded into a image buffer). Image is CCITT G3 codestream only (no headers, trailers etc.). The size of the image is 536 (width) x 133 (height).

I'm using the latest stable version, 3.9.4 downloaded a few days ago.

The warning messages indicate that the data is corrupt. The number of pixels decoded in each line do not match up with the expected width of 536.

Be wary, too, that a fax is usually 1728 pixels wide.

I'm not sure that I have anything else to go on here unless I were to look at the G3 image stream you provided and start trying to figure out the exact details of its corruption. I'd suggest going back to whatever produced this G3 image stream and check for malfunctions.

Thanks,

Lee.