2015.01.07 19:21 "Re: [Tiff] tools to validate a TIFF?", by Scott Ribe

2015.01.11 22:11 "Re: [Tiff] tools to validate a TIFF?", by Scott Ribe

So, OK, the header and single directory are fine, just as expected for this single-image, single-strip, binary image:

Magic: 0x4949 <little-endian> Version: 0x2a
Directory 0: offset 118772 (0x1cff4) next 0 (0)
ImageWidth (256) SHORT (3) 1<10208>
ImageLength (257) SHORT (3) 1<13216>
BitsPerSample (258) SHORT (3) 1<1>
Compression (259) SHORT (3) 1<4>
Photometric (262) SHORT (3) 1<0>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<8>
SamplesPerPixel (277) SHORT (3) 1<1>
RowsPerStrip (278) SHORT (3) 1<13216>
StripByteCounts (279) LONG (4) 1<118764>
XResolution (282) RATIONAL (5) 1<1200>
YResolution (283) RATIONAL (5) 1<1200>
PlanarConfig (284) SHORT (3) 1<1>
ResolutionUnit (296) SHORT (3) 1<2>

Software (305) ASCII (2) 78<fScanX 1.8.8 14-10-30 Co ...>

The question then is about the data in the strip. Is libtiff actually emitting invalid code words as claimed by certain utilities? Or are some TIFF readers broken?

The strip data begins with:

26 a0 78 28 20 3e 03 ec

And I'm getting that error message:

ImageIO: Fax4Decode Bad code word at line 1 of strip 0 (x 0)

So is that strip data valid or not? And if not, then I'll start tracing through libtiff to see how it comes to emit that data.

BTW, in my first post I mentioned having difficulty figuring out what the difference was between the flows which led to bad images vs good, because it seemed that I was using libtiff identically. Well, at a higher level there is a difference in cropping, and the data that results in bad images is likely to start with a long string of black pixels. I believe that G4 assumes the image starts with white, and if it starts with black requires a dummy code word indicating 0 white pixels at the start. That sure seems like where this could be going wrong--whether it's the writer or reader that is incorrect.

--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice