2009.03.14 02:04 "[Tiff] Confirming tiff integrity", by Robert Gallop

2009.03.14 02:04 "[Tiff] Confirming tiff integrity", by Robert Gallop

I'm a sysadmin and using sun solaris 10 as a platform for several of our applications. One application renders out tiff files, but sometimes (due to some code issues, fix is in the works, but may take the developers a while), the multipage tiff files have some issues.

One of the issues is that during rendering of the multipage tiff, the application fails to complete, and leaves a partial multipage tiff. I've found I can use either tiffinfo or tiffdump to detect these issues, since it will throw an error I can grep out of the run.

The second issue is that during rendering the application will complete the multipage tiff, but several, to all of the pages in the tiff will have solid black squares where there should be an image. This is the one I need help on.

Is there anyway to determine (via script, executable, something I need to compile, etc) if a multipage tiff contains a solid black square without viewing the actual tiff file (what I currently have to do, hundreds of times a month). I'd think that somewhere in the tiff, there might be some clue with a normal grey scale image, vs a pure solid black square on a page. What I'd really like to be able to do is write a script, or have an application that runs against a tiff and then gives a yes or no to any solid black images contained in that multipage tiff.

The tiff files range from 1 page to several thousand.

Here is the header from one of the tiffs and the first couple directories:

Thanks for any help or ideas you might have!

Magic: 0x4949 <little-endian> Version: 0x2a
Directory 0: offset 8 (0x8) next 10466 (0x28e2)
ImageWidth (256) LONG (4) 1<1600>
ImageLength (257) LONG (4) 1<2060>
BitsPerSample (258) SHORT (3) 1<1>
Compression (259) SHORT (3) 1<4>
Photometric (262) SHORT (3) 1<1>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<186>
SamplesPerPixel (277) SHORT (3) 1<1>
RowsPerStrip (278) LONG (4) 1<2060>
StripByteCounts (279) LONG (4) 1<10280>
XResolution (282) RATIONAL (5) 1<200>
YResolution (283) RATIONAL (5) 1<200>
Group4Options (293) LONG (4) 1<0>

Directory 1: offset 10466 (0x28e2) next 13700 (0x3584)
ImageWidth (256) LONG (4) 1<1600>
ImageLength (257) LONG (4) 1<2060>
BitsPerSample (258) SHORT (3) 1<1>
Compression (259) SHORT (3) 1<4>
Photometric (262) SHORT (3) 1<1>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<10644>
SamplesPerPixel (277) SHORT (3) 1<1>
RowsPerStrip (278) LONG (4) 1<2060>
StripByteCounts (279) LONG (4) 1<3056>
XResolution (282) RATIONAL (5) 1<200>
YResolution (283) RATIONAL (5) 1<200>
Group4Options (293) LONG (4) 1<0>

Directory 2: offset 13700 (0x3584) next 30512 (0x7730)
ImageWidth (256) LONG (4) 1<1600>
ImageLength (257) LONG (4) 1<2060>
BitsPerSample (258) SHORT (3) 1<1>
Compression (259) SHORT (3) 1<4>
Photometric (262) SHORT (3) 1<1>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<13878>
SamplesPerPixel (277) SHORT (3) 1<1>
RowsPerStrip (278) LONG (4) 1<2060>
StripByteCounts (279) LONG (4) 1<16633>
XResolution (282) RATIONAL (5) 1<200>
YResolution (283) RATIONAL (5) 1<200>
Group4Options (293) LONG (4) 1<0>