2005.07.28 15:32 "[Tiff] Problems with MS Windows generated tiff files", by Ian Thurlbeck

2005.07.28 16:58 "Re: [Tiff] Problems with MS Windows generated tiff files", by Joris Van Damme


A colleague has been sent a bunch of tiff files generated by some Adobe app. on windows.

There's defenetly some stuff wrong with this image, though my guess is you're pointing the finger in the wrong direction in your subject line and in your message body.

Here's a tag dump of the file.

File "img1.tif"
   Byte order: Intel
   Format: Classic TIFF

IFD Tree
   Single page at offset 8
      Exif IFD at offset 1967960

Single page
      Offset: 8
      Next IFD: 0

   NewSubfileType (1 LONG): -
   ImageWidth (1 SHORT): 1400
   ImageLength (1 SHORT): 1400
   BitsPerSample (1 SHORT): 8
   Compression (1 SHORT): No compression
   PhotometricInterpretation (1 SHORT): BlackIsZero
   StripOffsets (1 LONG): 7960

   SamplesPerPixel (1 SHORT): 1
   RowsPerStrip (1 SHORT): 1400
   StripByteCounts (1 LONG): 1960000
   XResolution (1 RATIONAL): 72
   YResolution (1 RATIONAL): 72
   ResolutionUnit (1 SHORT): Inch

   Software (29 ASCII): "Adobe Photoshop Elements 2.0"

   DateTime (20 ASCII): "2005:07:09 18:30:02"
   XMP (5036 BYTE): "<?xpacket begin='   ' id='W5M0MpCehiHzreSzNTczkc9...

   Photoshop (2628 BYTE): 56, 66, 73, 77, 4, 37, 0, 0, 0, 0, 0, 16, 0,...
   Exif IFD (1 LONG): 1967960

Exif IFD
      Offset: 1967960
      Error: Reading IFD: Premature end of data

This is a very typical Adobe generated file, as we can see from the Software tag, the XMP and Photoshop tag, and the presence of the Exif IFD. It is a single strip image, and that math is correct.

RowsPerStrip = ImageLength
     = 1400*1400*1 = 1960000
     = Single StripByteCount value

The position of the single image IFD, offset 8, is also typical. The single StripOffset + the single StripByteCount = 7960 + 1960000 = 1967960 = offset of Exif IFD. However, the size of the file is 1032192, which is considerably less. So it seems this file is truncated somewhere in the middle of the uncompressed image raster data. This is bound to cause problems in mainstream readers, and that's probably the cause of the corruption you're viewing. Advanced readers that also try and access the Exif IFD will have an additional problem to deal with, since the file is truncated before that IFD's position.

./tiff2ps ~/tmp/img1.tif > ~/tmp/img1.eps TIFFReadDirectory: Warning, /home/ian/tmp/img1.tif: Bogus "StripByteCounts" field, ignoring and calculating from imagelength. TIFFFillStrip: /home/ian/tmp/img1.tif: Read error on strip 146; got 2232 bytes, expected 7000. /home/ian/tmp/img1.tif: Can't read strip.

If you take stripchopping into account, this might make sense.

** Conclusion **

To me this seems like a file that probably was perfectly allright at one stage, but probably got truncated somewhere at some stage between the writer app writing it and your receiving it.

Joris Van Damme
Download your free TIFF tag viewer for windows here: