Repository navigation
feat: embed an sRGB ICC profile in JPEG and PNG exports - #1820
Merged
Merged
Conversation
Exports are sRGB-encoded but carried no color profile, so color-managed apps and print services had to assume sRGB (CyberTimon#1489). Embed the CC0 sRGB-v2-magic profile (736 bytes, from saucecontrol/Compact-ICC-Profiles) through image's ImageEncoder::set_icc_profile. Pixel data is unchanged. TIFF follows once CyberTimon#1752 lands; WebP, AVIF and JPEG XL are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Owner
|
LGTM, thanks! |
8 of 17 tasks
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.
Description
Part of #1489. RapidRAW's exports are sRGB-encoded (the render ends in
linear_to_srgb/ AgX), but they carry no color profile. Color-managed apps, print services and soft-proofing tools then have to guess, and some assume something other than sRGB.This embeds a small sRGB profile in JPEG and PNG exports through
image'sImageEncoder::set_icc_profile. Pixel data is unchanged. TIFF will follow after #1752 lands, as a few lines in its TIFF writer (agreed with its author in #1752).The profile is
sRGB-v2-magic.icc(736 bytes, CC0-1.0) from saucecontrol/Compact-ICC-Profiles, with description "sRGB". The even smaller "micro" variant reports its name as "uRGB", which could confuse labs and apps that display or check the profile name.Type of Change
Changes Made
src-tauri/icc/sRGB-v2-magic.iccplus a short README with its source and license.export_processing.rs:const SRGB_ICC_PROFILE = include_bytes!(…). The JPEG and PNG branches ofencode_image_to_bytesset it on their encoders (PNG now usesPngEncoderwithwrite_with_encoderinstead ofwrite_to). The TIFF branch is unchanged.Testing
Headless export of a Sony A7C II raw on Linux (Arch/Omarchy, Intel Arc 140V), checked with ImageMagick
identify(%[icc:description]):--keep-metadata--keep-metadatacargo fmt --checkclean; the build has no new warnings.Checklist
Additional Notes
write_main_ifdonce it lands; I'll send that as a small follow-up.map_3ch_to_rgb→clip_negative), so out-of-sRGB colors are gone before export. Adobe RGB/ProPhoto export (Support Custom Output Color Spaces & HDR Output #34, Feature request: Embed/select ICC color profile on export #1489) would need a wider working space, not just a different tag. Happy to share notes in Feature request: Embed/select ICC color profile on export #1489.AI Disclaimer:
🤖 Generated with Claude Code