feat(codecs): add TIFF raster reader and TIFF writer

TiffImageReader decodes strips and tiles (chunky or planar) with none,
LZW (old-style bit order tolerated), Deflate, PackBits and JPEG
compression (JPEGTables, YCbCr or RGB, lossless SOF3 tiles reshaped as
DNG writes them), predictors 2/3 and the DNG x2/x4 variants, 1-16 bit
integer and 16/32-bit float samples; tiles decode in parallel. Output
is a raw TiffRaster or a linear ImageBuffer. JPEG strips match libtiff
bit for bit.

TiffWriter writes 8/16-bit gray/RGB/RGBA, uncompressed or Deflate with
horizontal predictor, and embeds capture metadata from an Exif block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 10:02:27 +00:00
1 parent 016a06d147
commit 6d9ede0c47
10 files changed
+1409

No files matched your search

+1
View File
@@ -70,6 +70,7 @@ convert src16.ppm -depth 16 -compress Zip -define tiff:predictor=2 tiff/deflate1
convert src.ppm -compress LZW -define tiff:tile-geometry=16x16 tiff/lzw-tiled.tif
tiffcp -p separate -c zip src.ppm.tmp.tif tiff/planar-zip.tif 2>/dev/null || { convert src.ppm -compress None tiff/_tmp.tif; tiffcp -p separate -c zip tiff/_tmp.tif tiff/planar-zip.tif; rm tiff/_tmp.tif; }
convert src.ppm -compress None tiff/_tmp.tif && tiffcp -c jpeg:90 -r 16 tiff/_tmp.tif tiff/jpeg-ycbcr.tif && tiffcp -c jpeg:r:90 -r 16 tiff/_tmp.tif tiff/jpeg-rgb.tif && rm tiff/_tmp.tif
convert tiff/jpeg-ycbcr.tif tiff/jpeg-ycbcr.ppm && convert tiff/jpeg-rgb.tif tiff/jpeg-rgb.ppm
convert src16.ppm -define quantum:format=floating-point -depth 32 -compress Zip -define tiff:predictor=3 tiff/float32-pred3.tif
convert src.ppm -colorspace Gray -define tiff:photometric=min-is-white -compress None tiff/gray-miniswhite.tif
ls -l jpeg png tiff
Binary file not shown.
Binary file not shown.