2013.06.13 15:52 "[Tiff] TIFF Specification Allowance for Multi-Page vs. Reduced Res 2nd IFD", by Douglas Peterson

2013.06.13 15:52 "[Tiff] TIFF Specification Allowance for Multi-Page vs. Reduced Res 2nd IFD", by Douglas Peterson

*Background About Me*

I have put considerable effort into understanding the proper structure for TIFFs. I've read an Intro to TIFF Creation<http://paulbourke.net/dataformats/tiff/> and the NewSubFileType<http://www.awaresystems.be/imaging/tiff/tifftags/newsubfiletype.html>spec and learned to read hex (at an intro level). I have JHOVE and MAC OSX TiffUtil at my disposal. I say all this not to brag (as I'm sure I'm one of the least knowledgable members of this mailing list) but only to explain that I have tried very hard to resolve this issue on my own before appealing for help from this community.

*The Problem*

Our company is having a problem with several software packages reading our TIFFs as multi-page documents. That is, upon import/ingestion the software treats the two image IFDs in the TIFF as separate images that should both be imported.

Using JHOVE and TiffUtil I see our TIFFs create two IFDs (plus an EXIF IFD which is presumably not important to this discussion). IFD#0 is the primary image at full resolution. IFD#1 is a thumbnail of the primary image.

We want to continue to provide TIFFs with the IFD that contains a thumbnail as some users may have incorporated the thumbnails into their workflows. But we do not want these other programs to see the TIFFs as multi-page documents.

Exploring the structure of the TIFFs we are creating I cannot see anything wrong. IFD#1 is, as far as I can see, set to [Bit 0 = True][Bit 1 = False][Bit 2 = False][all other bits = False]. Which according to the spec should mean this IFD should be considered [reduced-resolution version of another image in this TIFF file] and not [single page of a multi-page image].

*My Questions for the Community*

  1. Can you please verify that our TIFF is following the specification regarding tagging IFDs representing thumbnails of the primary image?
  2. Can anyone clarify what the resulting JHOVE/TiffUtil/Hex would be in the following cases:

--- Bit 0 is set to 1 and bit 1 is set to 1
--- Bit 0 is set to 0 and bit 1 is set to 1
--- Bit 0 is set to 1 and bit 1 is set to 0
--- Bit 0 is set to 0 and bit 1 is set to 0

3) Is there any consensus on why the specification is written as a series of bit flags (which allows in theory for a given IFD to be flagged as both a multipage document and a reduced resolution version of the primary image? 4) What programs/workflows, that might be in use by our customers, require the IFD with the thumbnail? Put differently, what might "break" if we elect to not include this thumbnail IFD, resulting in a file with only one image IFD (the primary image)?

The second question is to further my understanding of how the flag bits work and to add additional verification that we are "doing it right" already.

*Download of small TIFF (referenced in rest of email):* https://www.dropbox.com/s/x00zamfho852s04/smalltiff.tif This file is produced by cropping the on screen image before processing. The thumbnail IFD therefore is the same pixel dimensions as the primary image.

*Download of full sized TIF* https://www.dropbox.com/s/waoi7kz3bpfo24s/1_120ASPH_f8_2871ppi_99eff.tif This is a normal (very large) output from our system. The thumbnail IFD is 160px long by 107px wide.

*Relevant Section from a hexdump:*
0039130 01 00 00 00 69 87 04 00 0b 00 fe 00 04 00 01 00
0039140 00 00 01 00 00 00 00 01 03 00 01 00 00 00 3b 00
0039150 00 00 01 01 03 00 01 00 00 00 3b 00 00 00 02 01
0039160 03 00 03 00 00 00 8e ba 03 00 03 01 03 00 01 00

*My notes*
00 fe = 254 = Tag for SubFileType
00 04 = 4 = Long Int Data Type
00 01 = 1 = One Value
00 00 00 01 = 1 = bit 0 set to 1 = Reduced Resolution Image

*Relevant Section of Directory 1 in TiffUtil - dump:* Directory 1: offset 233784 (0x39138) next 0 (0) *SubFileType (254) LONG (4) 1<1>*

ImageWidth (256) SHORT (3) 1<59>
ImageLength (257) SHORT (3) 1<59>
BitsPerSample (258) SHORT (3) 3<8 8 8>
Compression (259) SHORT (3) 1<1>
Photometric (262) SHORT (3) 1<2>

StripOffsets (273) LONG