2005.10.14 10:47 "[Tiff] Repair ImageLength of fax file", by Ulf Zibis

2005.10.19 01:55 "Re: [Tiff] Repair ImageLength of fax file", by Joris Van Damme

With hex viewer WinHex I didn't find any occurence of 000000000001, and only 21 occurencees of 010000000000.

So do you think, this file is repairable?

If you allow, I can send you this file (~200 kBytes) to have a short look. The content is not very private.

I've tried my thinking on your testfile.

First, I tried getting the strip with LibTiff. Problem is, LibTiff starts with reading the IFD, seeing the ImageLength=0 problem, and thus returns an error instead of a TIFF*, and no further investigation of the strip data is possible.

I've tried to see if at least my thinking on EOL counting might have been correct, with a solution other than LibTiff that did allow me to peek at the IFD and the strip data.

First thing I've noticed, is that it doesn't start with an EOL, as it should. I've found that most of the time (at least in my testimage library), buggy writers that do not write the first EOL, start with the first line compressed data. Best thing a decoder could do, is see if this first data makes any sense as a compressed image line. But LibTiff doesn't, and instead just skips to the first EOL. And so I've build my 'line-counting' algorithm to do the same, assuming the resulting imagelength is to be used with LibTiff anyway.

I thus find 2338 occurences of EOL. There is no trailing EOL either, when usually there is at least one, which makes all even more suspicious...

Without the trailing EOL, I would guess 2338 to be a suitable value for ImageLength. And so I tried changing the tag to this new value and... then, the image turns out fine.

The same process on other two pages yields an ImageLength of 2337 lines, and equally fine images after correcting the tag.

I've sent the repaired file to your private e-mail address.

Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be/
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html