2005.03.05 18:10 "[Tiff] Bogus StripByteCounts field", by Bob Friesenhahn

2005.03.05 19:23 "Re: [Tiff] Bogus StripByteCounts field", by Bob Friesenhahn

GraphicsMagick is using libtiff's scanline writer to write stripped TIFFs. For G4 and ZIP compression I notice that the files written produce this warning when read:

TIFFReadDirectory: Warning, golfer_zip.tif: Bogus "StripByteCounts" field, ignoring and calculating from imagelength.

TIFFWriteDirectory() is explicitly used before invoking TIFFClose().

Is there anything more that should be done in order for the StripByteCounts field to be written with a usable value?

What does the tiffdump on the resulting file look like?

tiffdump of GraphicsMagick output:

blade:~% tiffdump golfer_zip.tif

golfer_zip.tif:
Magic: 0x4d4d <big-endian> Version: 0x2a
Directory 0: offset 14330 (0x37fa) next 0 (0)
ImageWidth (256) SHORT (3) 1 <570>
ImageLength (257) SHORT (3) 1 <695>
BitsPerSample (258) SHORT (3) 1 <1>
Compression (259) SHORT (3) 1 <8>
Photometric (262) SHORT (3) 1 <1>
FillOrder (266) SHORT (3) 1 <1>
DocumentName (269) ASCII (2) 15 <golfer_zip.tif\0>
ImageDescription (270) ASCII (2) 54 < Image generated by AFPL ...>
StripOffsets (273) LONG (4) 1 <8>
Orientation (274) SHORT (3) 1 <1>
SamplesPerPixel (277) SHORT (3) 1 <1>
RowsPerStrip (278) SHORT (3) 1 <695>
StripByteCounts (279) LONG (4) 1 <14321>
PlanarConfig (284) SHORT (3) 1 <1>
Software (305) ASCII (2) 64 <GraphicsMagick 1.2 unrel ...>
SampleFormat (339) SHORT (3) 1 <1>

Tiffdump of tiffcp output:

blade:~% tiffdump golfer_zip2.tif

golfer_zip2.tif:
Magic: 0x4d4d <big-endian> Version: 0x2a
Directory 0: offset 14870 (0x3a16) next 0 (0)
ImageWidth (256) SHORT (3) 1 <570>
ImageLength (257) SHORT (3) 1 <695>
BitsPerSample (258) SHORT (3) 1 <1>
Compression (259) SHORT (3) 1 <8>
Photometric (262) SHORT (3) 1 <1>
FillOrder (266) SHORT (3) 1 <1>
DocumentName (269) ASCII (2) 15 <golfer_zip.tif\0>
ImageDescription (270) ASCII (2) 54 < Image generated by AFPL ...>
StripOffsets (273) LONG (4) 1 <8>
Orientation (274) SHORT (3) 1 <1>
SamplesPerPixel (277) SHORT (3) 1 <1>
RowsPerStrip (278) SHORT (3) 1 <695>
StripByteCounts (279) LONG (4) 1 <14861>
PlanarConfig (284) SHORT (3) 1 <1>
Software (305) ASCII (2) 64 <GraphicsMagick 1.2 unrel ...>
SampleFormat (339) SHORT (3) 1 <1>

Bob

======================================
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/