Files
photocraft/crates/codecs/src
bf7dd539f5 codecs: read and write TIFF extra samples (spot and alpha channels)
A TIFF's extra samples other than the image alpha (spot colours and
further alpha channels, ExtraSamples 0) were dropped on decode, and the
encoder could write only one alpha sample. They now travel through
`Metadata::extra_samples`, one plane per sample with its ExtraSamples
value as `kind`.

- Decode: chunky and planar, strips and tiles, every depth, Gray, RGB,
  CMYK and Lab. At most 16 (`MAX_EXTRA_SAMPLES`) are kept; the planes
  count against `Limits::max_alloc` and are allocated fallibly. Layout
  and pixel data are unchanged: the first alpha sample (1 or 2) is still
  the image alpha.
- Encode: extra samples follow the colour and alpha samples, with their
  kinds in the ExtraSamples tag; Lab as CIELab (float Lab at 16 bits).
  More than 16, or a plane of the wrong size, is an error.
- `Image::convert` converts the planes with the sample type, and
  `Image::oriented` turns them with the image.
- main's `extra_samples_that_are_not_alpha_are_dropped` becomes
  `extra_samples_that_are_not_alpha_are_kept_apart`: same inputs, same
  layout and data, and it now checks the extra planes.

From #3121 (split out of #7415).

Co-authored-by: Zer0C00L01 <12090083+Zer0C00L01@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 11:25:23 -04:00
..
…