From 12f16dbfdd0187db1e15cadc42b60c01f836b017 Mon Sep 17 00:00:00 2001 From: Wim Pomp Date: Sat, 3 Oct 2026 16:50:04 +0200 Subject: [PATCH] - ignore missing colormap --- .gitignore | 3 ++- src/decoder/image.rs | 10 +++++----- src/directory.rs | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 4ad8ac2..dbb6995 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ - /target/ **/*.rs.bk Cargo.lock tests/benches/corpus/ +.idea +.agentbridge \ No newline at end of file diff --git a/src/decoder/image.rs b/src/decoder/image.rs index 071d28c..fd062d0 100644 --- a/src/decoder/image.rs +++ b/src/decoder/image.rs @@ -467,11 +467,11 @@ impl Image { } Some(map) } - None => { - return Err(TiffError::FormatError( - TiffFormatError::RequiredTagNotFound(Tag::ColorMap), - )); - } + // A missing palette is not an error. The pixel values of an indexed image are just + // indices into the palette, and the palette itself is only display information, so + // the image still decodes. Callers observe the absence as `None` from + // `Decoder::color_map`. + None => None, } } else { None diff --git a/src/directory.rs b/src/directory.rs index 336abae..be275da 100644 --- a/src/directory.rs +++ b/src/directory.rs @@ -171,7 +171,7 @@ mod tests { dir.get(Tag::Unknown(1)) .expect("tag 1 should be present after this chain") .count(), - u16::MAX.into() + u64::from(u16::MAX) ); }