Allow ICC conversion for Uncompressed CIE Lab, CMYK and RGB TIFF#3054
Merged
JimBobSquarePants merged 5 commits intomainfrom Jan 30, 2026
Merged
Allow ICC conversion for Uncompressed CIE Lab, CMYK and RGB TIFF#3054JimBobSquarePants merged 5 commits intomainfrom
JimBobSquarePants merged 5 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds TIFF decoding improvements to support CIE Lab 16-bit (chunky + planar) and enables ICC-based color conversion for CMYK/Lab paths, plus updates wiring so decoders can access frame metadata and decoder options.
Changes:
- Add new 16-bit CIE Lab TIFF color decoders (chunky + planar) with endianness handling and ICC conversion support.
- Update CMYK TIFF decoding to support ICC conversion and use buffer/SIMD-based row processing.
- Pass
ImageFrameMetadata+DecoderOptionsinto the TIFF color decoder factory; add tests + new LFS test assets/reference outputs.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs | Passes frame metadata/options into color decoder creation for ICC-aware decoding. |
| src/ImageSharp/Formats/Tiff/TiffDecoderOptionsParser.cs | Adjusts CieLab parsing to allow more than just 8-bit (but currently lacks bit-depth validation). |
| src/ImageSharp/Formats/Tiff/PhotometricInterpretation/TiffColorDecoderFactory{TPixel}.cs | Selects new CIE Lab 8/16-bit decoders and passes ICC context to ICC-aware decoders. |
| src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CmykTiffColor{TPixel}.cs | Adds ICC conversion support and SIMD row conversion pipeline. |
| src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLab8TiffColor{TPixel}.cs | Renames 8-bit CieLab decoder for clarity. |
| src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLab8PlanarTiffColor{TPixel}.cs | Renames 8-bit planar CieLab decoder for clarity. |
| src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLab16TiffColor{TPixel}.cs | New 16-bit chunky CieLab decoder (endianness + ICC conversion). |
| src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLab16PlanarTiffColor{TPixel}.cs | New 16-bit planar CieLab decoder (endianness + ICC conversion). |
| src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrConverter.cs | Minor default initialization simplification. |
| tests/ImageSharp.Tests/TestImages.cs | Adds TIFF ICC test image paths. |
| tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs | Adds ICC conversion test; currently also comments out an existing test case. |
| tests/Images/Input/Tiff/icc-profiles/* | Adds new LFS-backed TIFF ICC test assets. |
| tests/Images/External/ReferenceOutput/TiffDecoderTests/* | Adds new LFS-backed reference outputs for ICC conversion test. |
| .github/workflows/build-and-test.yml | Adjusts PR trigger types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/ImageSharp/Formats/Tiff/PhotometricInterpretation/TiffColorDecoderFactory{TPixel}.cs
Show resolved
Hide resolved
src/ImageSharp/Formats/Tiff/PhotometricInterpretation/TiffColorDecoderFactory{TPixel}.cs
Show resolved
Hide resolved
src/ImageSharp/Formats/Tiff/PhotometricInterpretation/TiffColorDecoderFactory{TPixel}.cs
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites
Description
This pull request adds support for decoding TIFF images with CIE Lab color data in both 8-bit and 16-bit per channel formats, including both planar and interleaved storage. It also updates the CMYK TIFF decoder to support ICC color profile conversion and makes the decoder factory aware of these new types. The changes improve color accuracy and extensibility for TIFF decoding.
New TIFF color decoders and ICC profile support:
CieLab16TiffColor<TPixel>andCieLab16PlanarTiffColor<TPixel>classes to decode 16-bit per channel CIE Lab TIFF images, with proper ICC profile conversion and endianness handling. [1] [2]CmykTiffColor<TPixel>to support ICC profile conversion and use buffer-based SIMD processing for more efficient decoding. [1] [2]Refactoring and naming consistency:
CieLabTiffColor<TPixel>andCieLabPlanarTiffColor<TPixel>toCieLab8TiffColor<TPixel>andCieLab8PlanarTiffColor<TPixel>, respectively, to clarify that these handle 8-bit per channel data. [1] [2]Decoder factory enhancements:
TiffColorDecoderFactory<TPixel>to instantiate the correct decoder based on bits per sample and to pass necessary metadata, options, and allocator for ICC profile-aware decoders. [1] [2] [3] [4] [5]Minor improvements:
YCbCrToRgbConverter.