2020.05.17 09:41 "[Tiff] fax2tiff adds extra line", by John Muccigrosso

2020.05.18 21:10 "Re: [Tiff] Tiff Digest, Vol 19, Issue 2", by Richard Nolde

I'm using pdfimages to process a PDFs which results in some ccitt files. Using fax2tiff I'm able to turn those into slightly more manageable tiffs. Here's the problem: in some cases fax2tiff produces files that seem to be 1 row too long. Here's some example output when I use the verbose mode on one such file:

> Fax4Decode: Warning, Premature EOL at line 5200 of strip 4294967295 (got 0, expected 3450).
> /path/to/file/filename.ccitt:
> 5201 rows in input
> 0 total bad rows
> 0 max consecutive bad rows

I downloaded your file and ran fax2tiff -v -4 -P -X 3450 -B -M -o alex-039.tif alex-039.ccitt, followed by tiffinfo alex-039.tif. I was suspicious of the large value for the strip number reported in your error message and this is confirmed by the output of tiffinfo on the output file.

TIFF Directory at offset 0xc21a (49690)
  Image Width: 3450 Image Length: 5201
  Resolution: 204, 196 pixels/inch
  Bits/Sample: 1
  Compression Scheme: CCITT Group 3
  Photometric Interpretation: min-is-white
  FillOrder: lsb-to-msb
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 1
  Rows/Strip: (infinite)
  Planar Configuration: single image plane
  Page Number: 0-1
  Software: fax2tiff
  Group 3 Options: (0 = 0x0)
  Fax Data: clean (0 = 0x0)
  Bad Fax Lines: 0
  Consecutive Bad Fax Lines: 0

While I am not familiar with the code for fax2tiff, it appears this behavior is due to running off the end of the data when the rows per strip tag doesn't get set correctly. The fix might be as simple as updating the Image Length field when this happens. Hope this helps.

Richard Nolde