Skip to content

feat: embed an sRGB ICC profile in JPEG and PNG exports - #1820

Merged
CyberTimon merged 1 commit into
CyberTimon:mainfrom
yojen7:feat/embed-srgb-icc
Oct 3, 2026
Merged

CyberTimon merged 1 commit into
CyberTimon:mainfrom
yojen7:feat/embed-srgb-icc

Conversation

@yojen7

@yojen7 yojen7 commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

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's ImageEncoder::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

  • New feature

Changes Made

  • src-tauri/icc/sRGB-v2-magic.icc plus a short README with its source and license.
  • export_processing.rs: const SRGB_ICC_PROFILE = include_bytes!(…). The JPEG and PNG branches of encode_image_to_bytes set it on their encoders (PNG now uses PngEncoder with write_with_encoder instead of write_to). The TIFF branch is unchanged.
  • WebP, AVIF and JPEG XL are untouched for now (different encoders); happy to follow up. TIFF follows after fix: write EXIF metadata and the sRGB profile into TIFF exports #1752.

Testing

  • These changes were tested locally by a human and confirmed to work. (Tested by the agent on Linux as described below; a human reviewed the change and results.)
  • I haven't added any automated tests to the code because the codebase currently lacks a test suite.

Headless export of a Sony A7C II raw on Linux (Arch/Omarchy, Intel Arc 140V), checked with ImageMagick identify (%[icc:description]):

Export Profile
JPEG, with and without --keep-metadata sRGB (the EXIF patching keeps it)
PNG, with and without --keep-metadata sRGB
  • The embedded profile is byte-identical to the bundled file.
  • cargo fmt --check clean; the build has no new warnings.

Checklist

  • My code follows the project's code style
  • I haven't added unnecessary AI-generated code comments
  • My changes generate no new warnings or errors

Additional Notes

AI Disclaimer:

  • This PR is created by an AI agent
  • This PR is mostly AI-generated but edited/merged together by a human
  • This PR was handwritten with AI assistance (spell check, logic suggestions, error resolving)
  • This PR contains only blood, sweat, and coffee (AI-free)

🤖 Generated with Claude Code

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>
@CyberTimon

Copy link
Copy Markdown
Owner

LGTM, thanks!

@CyberTimon
CyberTimon merged commit c50001a into CyberTimon:main Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants