2004.12.11 02:06 "[Tiff] TIFF Pyramid", by Eric Vergnaud

2004.12.11 17:41 "Re: [Tiff] TIFF Pyramid", by Joris Van Damme

Eric,

Is there a sample on how to write tiff pyramid. I'm not 100% sure on how to create and save the subifds.

I've build such a tile pyramid TIFF with Photoshop 7.0, and this is what that got me:

Page 0 at offset 8
   + SubIFDs 0 at offset 6432380
   + SubIFDs 1 at offset 7331432
   + SubIFDs 2 at offset 7485948
   + Exif IFD 0 at offset 6432336

Page 0 at offset 8
NewSubfileType, 1 LONG: -
ImageWidth, 1 SHORT: 6000
ImageLength, 1 SHORT: 4003
BitsPerSample, 3 SHORT: 8, 8, 8
Compression, 1 SHORT: JPEG ('new-style' JPEG)
PhotometricInterpretation, 1 SHORT: YCbCr
StripOffsets, 1335 LONG: 34220, 39056, 44068, 49084, 54100, 59258,...
SamplesPerPixel, 1 SHORT: 3
RowsPerStrip, 1 SHORT: 3
StripByteCounts, 1335 LONG: 4836, 5012, 5015, 5016, 5158, 5054,...
XResolution, 1 RATIONAL: 305
YResolution, 1 RATIONAL: 305
PlanarConfiguration, 1 SHORT: Chunky format
ResolutionUnit, 1 SHORT: Inch
Software, 20 ASCII: "Adobe Photoshop 7.0"
DateTime, 20 ASCII: "2004:12:11 18:03:21"
SubIFDs, 1 IFD: 6432380
JPEGTables, 459 UNDEFINED: 255, 216, 255, 219, 0, 132, 0, 16, 11,...
XMP, 4649 BYTE: "<?xpacket begin=' ' id='W5M0MpCehiHzreSzNTczkc9d...
Photoshop, 18102 BYTE: 56, 66, 73, 77, 4, 37, 0, 0, 0, 0, 0, 16, 0,...
Exif IFD, 1 LONG: 6432336

SubIFDs 0 at offset 6432380
NewSubfileType, 1 LONG: Reduced-resolution version
ImageWidth, 1 SHORT: 3000
ImageLength, 1 SHORT: 2002
BitsPerSample, 3 SHORT: 8, 8, 8
Compression, 1 SHORT: JPEG ('new-style' JPEG)
PhotometricInterpretation, 1 SHORT: YCbCr
StripOffsets, 286 LONG: 6435336, 6438382, 6441464, 6444610,...
SamplesPerPixel, 1 SHORT: 3
RowsPerStrip, 1 SHORT: 7
StripByteCounts, 286 LONG: 3046, 3081, 3145, 3108, 3233, 3227,...
XResolution, 1 RATIONAL: 152,5
YResolution, 1 RATIONAL: 152,5
PlanarConfiguration, 1 SHORT: Chunky format
ResolutionUnit, 1 SHORT: Inch
JPEGTables, 459 UNDEFINED: 255, 216, 255, 219, 0, 132, 0, 16, 11,...

SubIFDs 1 at offset 7331432
NewSubfileType, 1 LONG: Reduced-resolution version
ImageWidth, 1 SHORT: 1500
ImageLength, 1 SHORT: 1001
BitsPerSample, 3 SHORT: 8, 8, 8
Compression, 1 SHORT: JPEG ('new-style' JPEG)
PhotometricInterpretation, 1 SHORT: YCbCr
StripOffsets, 72 LONG: 7332676, 7334308, 7336024, 7337828, 7339494,...
SamplesPerPixel, 1 SHORT: 3
RowsPerStrip, 1 SHORT: 14
StripByteCounts, 72 LONG: 1632, 1715, 1803, 1665, 1649, 1627, 2054,...
XResolution, 1 RATIONAL: 76,25
YResolution, 1 RATIONAL: 76,25
PlanarConfiguration, 1 SHORT: Chunky format
ResolutionUnit, 1 SHORT: Inch
JPEGTables, 459 UNDEFINED: 255, 216, 255, 219, 0, 132, 0, 16, 11,...

SubIFDs 2 at offset 7485948
NewSubfileType, 1 LONG: Reduced-resolution version
ImageWidth, 1 SHORT: 750
ImageLength, 1 SHORT: 501
BitsPerSample, 3 SHORT: 8, 8, 8
Compression, 1 SHORT: JPEG ('new-style' JPEG)
PhotometricInterpretation, 1 SHORT: YCbCr
StripOffsets, 18 LONG: 7486760, 7489102, 7491628, 7494930, 7498102,...
SamplesPerPixel, 1 SHORT: 3
RowsPerStrip, 1 SHORT: 29
StripByteCounts, 18 LONG: 2341, 2525, 3302, 3171, 3588, 3985, 3871,...
XResolution, 1 RATIONAL: 38,125
YResolution, 1 RATIONAL: 38,125
PlanarConfiguration, 1 SHORT: Chunky format
ResolutionUnit, 1 SHORT: Inch
JPEGTables, 459 UNDEFINED: 255, 216, 255, 219, 0, 132, 0, 16, 11,...

Exif IFD 0 at offset 6432336
ColorSpace, 1 SHORT: Uncalibrated
PixelXDimension, 1 LONG: 6000
PixelYDimension, 1 LONG: 4003

In my opinion, that is completely in accordance with the specification supplement that describes the SubIFDs tag. All differently sized versions are part of the single main IFD, either the main image in that IFD, or the image in a SubIFD of that IFD. That should indicate to a reader that this is all really the same image. The NewSubfileType tag is used as an extra indication of this relation. The SubIFDs tag points only to the first SubIFD, and each SubIFD points to the next.

As Photoshop writes it, the big 'real' image is written as primary image in the primary page IFD, and each subsequent SubIFD has vertical and horizontal pixel sizes divided by 2. That you could decide to mimick, but you could also do this any other way. DNG and related TIFFs store a thumbnail in the primary IFD, marked as NewSubfileType 'Reduced-resolution version', if I'm not mistaking. So the only really important thing is to keep all downsamples part of the same main IFD, thus indicating it's the same image, and thus also being ready to one day write two or more tile pyramids in the same TIFF, as multiple pages.

Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html