| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2004.05.19 13:54 "Re: Recovering tiff faxes corrupted with 3.6.0", by Frank WarmerdamAndrew McGill wrote:
> Hi Frank
>
> Thanks for the reply - I stayed up late in this time zone, and
> yes, I did find that hacking tiffset was not the joy I had
> intended. I did download a copy of the TIFF spec (6.0) from
> Adobe, and I found that the following fixes this corruption very
> neatly (and corrupts perfectly good tiff files as well):
>
> #! /usr/bin/perl
> # Public domain
> # 266 03=short 01=std, 02=rev
> # Tag Type Count Value
> # 0 1 2 3 4 5 6 7 8
> use English;
> undef $IFS;
> while(<>) {
> s{\x01\x03\x00\x01\x00\x00\x00\x02\x00}
> {\x01\x03\x00\x01\x00\x00\x00\x01\x00}sg;
> print;
> }
>
> The code searches for the "FillOrder" block tag = 0A01 type=0300
> count=01000000 value=0200 and sets the value to 0100, which
> reverses the bit order. (I couldn't convince perl to search for
> \x0A which should be at the head of the block, so I left it off).
>
> The reason this works, as I understand it is that libtiff
> (unpatched) reversed the fillorder in the data, but the header
> was marked as read-only. Reversing the fillorder in the header
> makes the files readable again.
>
> You are welcome to put this in the contrib section or hide it in
> the documentation.
Andrew,
I have taken the liberty of cc:ing this to the mailing list in case it is
helpful to anyone else, or if anyone recognises this as some sort of bug
in libtiff. The list archive is my (and the communities) memory. :-)
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
|
|||||||