From 747c08c560449f64125d5d03c1b44759931effed Mon Sep 17 00:00:00 2001 From: TomNicholas Date: Sat, 18 Jul 2026 15:50:46 -0700 Subject: [PATCH] fix: default SamplesPerPixel to 1 when tag is absent The TIFF 6.0 specification defines SamplesPerPixel (tag 277) with a default value of 1. Some single-channel grayscale TIFFs omit the tag entirely (e.g. PerkinElmer/Phenix microscopy images in the Cell Painting Gallery). Previously IFD parsing panicked with 'samples_per_pixel not found' on such files; now it falls back to the spec default of 1. --- .../other/grayscale_no_samplesperpixel.tif | Bin 0 -> 114 bytes fixtures/other/readme.md | 8 ++++++ src/ifd.rs | 5 +++- src/test/missing_samples_per_pixel.rs | 23 ++++++++++++++++++ src/test/mod.rs | 1 + 5 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 fixtures/other/grayscale_no_samplesperpixel.tif create mode 100644 src/test/missing_samples_per_pixel.rs diff --git a/fixtures/other/grayscale_no_samplesperpixel.tif b/fixtures/other/grayscale_no_samplesperpixel.tif new file mode 100644 index 0000000000000000000000000000000000000000..f158ddeeb2c472d4fe0fae84af646c9e09433fe1 GIT binary patch literal 114 zcmebD)MDUZU;tr8W(GzeiwTGsk=RU7Hb@mSlnqkHhQt