Overview

I investigated cases where ImageMagick does not work properly when creating pyramidal TIFFs for IIIF image delivery.

References

Conversion methods are explained on pages like the following.

https://samvera.github.io/serverless-iiif/docs/source-images#creating-tiled-tiffs

Using the VIPS command line

# For a 3-channel source image
vips tiffsave source_image.tif output_image.tif --tile --pyramid --compression jpeg --tile-width 256 --tile-height 256

# For a source image with an alpha channel
vips extract_band source_image.tif temp_image.v 0 --n 3 \
  && vips tiffsave temp_image.v output_image.tif --tile --pyramid --compression jpeg --tile-width 256 --tile-height 256 \
  && rm temp_image.v

Using ImageMagick

convert source_image.tif -alpha off \
  -define tiff:tile-geometry=256x256 \
  -define tiff:generate-pyramids=true \
  -compress jpeg \
  'ptif:output_image.tif'

Target Data

The following image was used.

“Izumi no Kuni Ezu” (Map of Izumi Province), manuscript copy. National Diet Library Digital Collection https://dl.ndl.go.jp/pid/1286201 (accessed 2025-03-11)

https://dl.ndl.go.jp/api/iiif/1286201/R0000001/full/full/0/default.jpg

wget -O input.jpg https://dl.ndl.go.jp/api/iiif/1286201/R0000001/full/full/0/default.jpg

VIPS command line

Perform the conversion.

vips tiffsave input.jpg output_vips.tif --tile --pyramid --compression jpeg --tile-width 256 --tile-height 256

Then verify the result with the following.

tiffinfo output_vips.tif
=== TIFF directory 0 ===
TIFF Directory at offset 0x962908 (9840904)
  Image Width: 13300 Image Length: 10400
  Tile Width: 256 Tile Length: 256
  Resolution: 72, 72 pixels/inch
  Bits/Sample: 8
  Sample Format: unsigned integer
  Compression Scheme: JPEG
  Photometric Interpretation: YCbCr
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 3
  Planar Configuration: single image plane
  JPEG Tables: (574 bytes)

=== TIFF directory 1 ===
TIFF Directory at offset 0xc8d468 (13161576)
  Subfile Type: reduced-resolution image (1 = 0x1)
  Image Width: 6650 Image Length: 5200
  Tile Width: 256 Tile Length: 256
  Resolution: 72, 72 pixels/inch
  Bits/Sample: 8
  Compression Scheme: JPEG
  Photometric Interpretation: YCbCr
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 3
  Planar Configuration: single image plane
  JPEG Tables: (574 bytes)

=== TIFF directory 2 ===
TIFF Directory at offset 0xd74710 (14108432)
  Subfile Type: reduced-resolution image (1 = 0x1)
  Image Width: 3325 Image Length: 2600
  Tile Width: 256 Tile Length: 256
  Resolution: 72, 72 pixels/inch
  Bits/Sample: 8
  Compression Scheme: JPEG
  Photometric Interpretation: YCbCr
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 3
  Planar Configuration: single image plane
  JPEG Tables: (574 bytes)

=== TIFF directory 3 ===
TIFF Directory at offset 0xdb5228 (14373416)
  Subfile Type: reduced-resolution image (1 = 0x1)
  Image Width: 1662 Image Length: 1300
  Tile Width: 256 Tile Length: 256
  Resolution: 72, 72 pixels/inch
  Bits/Sample: 8
  Compression Scheme: JPEG
  Photometric Interpretation: YCbCr
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 3
  Planar Configuration: single image plane
  JPEG Tables: (574 bytes)

=== TIFF directory 4 ===
TIFF Directory at offset 0xdc72c4 (14447300)
  Subfile Type: reduced-resolution image (1 = 0x1)
  Image Width: 831 Image Length: 650
  Tile Width: 256 Tile Length: 256
  Resolution: 72, 72 pixels/inch
  Bits/Sample: 8
  Compression Scheme: JPEG
  Photometric Interpretation: YCbCr
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 3
  Planar Configuration: single image plane
  JPEG Tables: (574 bytes)

=== TIFF directory 5 ===
TIFF Directory at offset 0xdcca76 (14469750)
  Subfile Type: reduced-resolution image (1 = 0x1)
  Image Width: 415 Image Length: 325
  Tile Width: 256 Tile Length: 256
  Resolution: 72, 72 pixels/inch
  Bits/Sample: 8
  Compression Scheme: JPEG
  Photometric Interpretation: YCbCr
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 3
  Planar Configuration: single image plane
  JPEG Tables: (574 bytes)

=== TIFF directory 6 ===
TIFF Directory at offset 0xdce62a (14476842)
  Subfile Type: reduced-resolution image (1 = 0x1)
  Image Width: 207 Image Length: 162
  Tile Width: 256 Tile Length: 256
  Resolution: 72, 72 pixels/inch
  Bits/Sample: 8
  Compression Scheme: JPEG
  Photometric Interpretation: YCbCr
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 3
  Planar Configuration: single image plane
  JPEG Tables: (574 bytes)

Multiple TIFF directories (layers) exist, and it appears to have been properly created as a pyramidal TIFF (multi-resolution TIFF).

ImageMagick

Perform the conversion.

convert input.jpg -alpha off \
  -define tiff:tile-geometry=256x256 \
  -define tiff:generate-pyramids=true \
  -compress jpeg \
  'ptif:output_convert.tif'

Then verify the result with the following.

tiffinfo output_convert.tif
=== TIFF directory 0 ===
TIFF Directory at offset 0x1989f46 (26779462)
  Image Width: 13300 Image Length: 10400
  Tile Width: 256 Tile Length: 256
  Bits/Sample: 8
  Compression Scheme: JPEG
  Photometric Interpretation: RGB color
  FillOrder: msb-to-lsb
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 3
  Planar Configuration: single image plane
  Page Number: 0-1
  White Point: 0.3127-0.329
  PrimaryChromaticities: 0.640000,0.330000,0.300000,0.600000,0.150000,0.060000
  JPEG Tables: (289 bytes)

Only TIFF directory 0 exists, indicating that it is very likely not a pyramidal TIFF (multi-resolution TIFF).

Summary

The results seem to vary depending on the ImageMagick version, but we were able to confirm cases where pyramidal TIFFs cannot be created.

I was not able to identify the specific cause, but it appears necessary to consider using VIPS or other tools instead.

This is somewhat incomplete information, but I hope it serves as a helpful reference.