Received: by smtp02.oce.nl (4.1/SMI-4.1)
	id AA14917; Sat, 20 Jun 98 03:09:28 +0200
Received: from sgi.sgi.com (SGI.COM [192.48.153.1])
	by oce.nl (8.9.0/8.9.0) with ESMTP id CAA03318
	for <rvdt@oce.nl>; Sat, 20 Jun 1998 02:39:32 +0200 (MET DST)
Received: from cthulhu.engr.sgi.com (cthulhu.engr.sgi.com [192.26.80.2]) by sgi.sgi.com (980309.SGI.8.8.8-aspam-6.2/980304.SGI-aspam: SGI does not authorize the use of its proprietary systems or networks for unsolicited or bulk email from the Internet.) via ESMTP id RAA09833; Fri, 19 Jun 1998 17:38:01 -0700 (PDT)
	mail_from (owner-tiff@sgi.engr.sgi.com)
Received: (from majordomo-owner@localhost)
	by cthulhu.engr.sgi.com (980427.SGI.8.8.8/970903.SGI.AUTOCF)
	id PAA60739
	for tiff-list;
	Fri, 19 Jun 1998 15:44:09 -0700 (PDT)
	mail_from (owner-tiff@sgi.sgi.com)
Received: from sgi.sgi.com (sgi.engr.sgi.com [192.26.80.37])
	by cthulhu.engr.sgi.com (980427.SGI.8.8.8/970903.SGI.AUTOCF)
	via ESMTP id PAA86834
	for <tiff-relay@cthulhu.engr.sgi.com>;
	Fri, 19 Jun 1998 15:44:07 -0700 (PDT)
	mail_from (owner-tiff@sgi.sgi.com)
Received: from dub-img-4.compuserve.com (dub-img-4.compuserve.com [149.174.206.134]) by sgi.sgi.com (980309.SGI.8.8.8-aspam-6.2/980304.SGI-aspam: SGI does not authorize the use of its proprietary systems or networks for unsolicited or bulk email from the Internet.) via ESMTP id PAA10710
	for <tiff@sgi.com>; Fri, 19 Jun 1998 15:43:53 -0700 (PDT)
	mail_from (ScottKennedy@compuserve.com)
Received: (from root@localhost)
	by dub-img-4.compuserve.com (8.8.6/8.8.6/2.12) id SAA27718
	for tiff@sgi.com; Fri, 19 Jun 1998 18:43:52 -0400 (EDT)
Date: Fri, 19 Jun 1998 18:43:21 -0400
From: Scott Kennedy <ScottKennedy@compuserve.com>
Subject: damaged tiff file update
To: tiff list <tiff@sgi.com>
Message-Id: <199806191843_MC2-40C6-736E@compuserve.com>
Mime-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1
Content-Disposition: inline
Sender: owner-tiff@fddi-sgi.sgi.com
Precedence: bulk

Damaged tiff update

My thanks to Gerben Vos., Nick Day, and Helge for their comments last wee=
k
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 fil=
e.
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, 27=
8,
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 wi=
th
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 byte=
s
from the beginning of the compressed strip, as is certain, is there anywa=
y
to decompress it correctly?

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


Scott Kennedy
