AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

1998.06.11 15:09 "Damaged Tiff files", by Scott Kennedy
1998.06.19 22:43 "damaged tiff file update", by Scott Kennedy
1998.06.20 08:54 "Re: damaged tiff file update", by Frank D. Cringle

1998.06.19 22:43 "damaged tiff file update", by Scott Kennedy

Damaged tiff update

My thanks to Gerben Vos., Nick Day, and Helge for their comments last week about this topic. I wouldn't have gotten anywhere without your starting pointers. And while I've made some progress, I'm stuck again. Anyhow, here's how I proceeded.

I was dealing with group 4 compressed tifs, so importing the data in photoshop as raw was unfortunately not an option.

Fearing libtiff may not run correctly under Windows NT, I found a number of windows friendly utilities that a) would read out all the tag values in a tif file b) open the file in editable hexadecimal mode and c) convert regular numbers to hexadecimal. By reading up on the adobe tiff specs as suggested, I determined that I was dealing with little-endian tiffs. Bad news in that they were compressed; good news in that my file tags were still intact at the end of each file.

I had hundreds of good files to compare with the bad files, and after staring at all of them long enough, I realized my good files had an IFD offset that was, invariably, 236 less than the size (in bytes) of the file. I also noticed that the value of tag 279, stripbytecount, was invariably 244 less than the size in bytes of the file. The values of all the other tags used in these files (tags 254, 256, 257, 258, 259, 262, 273, 277, 278, 282, 283, 296, and 305) were identical in all good files.

Using the hexadecimal editor, I was able to insert the correct tif type (49 49 2A 00) and the correct IFD offset at the start of each of the damaged files. I was also able, after comparing the ends of many files (i.e., the tag section) in hexadecimal format, to spot where the StripByteCount was recorded and then insert the correct value in the damaged files.

The files thus repaired opened as tif files, and when I used the utility that would read out all tag values in the file, all my tags were there with correct values in the previously damaged files.

However, my image date still isn't showing up correctly. All the files have an Image width of 1696 pixels, and image length of 2200 pixels, and a rowsperstrip value of 2200, leading me to figure (as I'm very new at this) that the data was compressed in a single strip. If I'm missing a few bytes from the beginning of the compressed strip, as is certain, is there anyway to decompress it correctly?

Any thoughts would be appreciated, and thanks again for the earlier help.

Scott Kennedy