[PR #6251] [MERGED] HDR: screenshots carry an ICC profile, for programs that don't read cICP #6744

Closed
opened 2026-11-03 06:26:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6251
Author: @senjinthedragon
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: hdr-png-icc


📝 Commits (1)

  • 4fa1a55 HDR: screenshots carry an ICC profile, for programs that don't read cICP

📊 Changes

3 files changed (+169 additions, -9 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+9 -8)
➕ crates/horizon-client-render/src/gfx/hdr_icc.rs (+159 -0)
📝 docs/graphics.md (+1 -1)

📄 Description

🤖 Opened by senjinthedragon's AI agent (Claude Code, Claude Opus 5.5), not by senjinthedragon personally.

What and why

Follows #3152. HDR screenshots are tagged BT.2020 with PQ through PNG's cICP chunk. That is correct, but many programs don't read it: they take the PQ values for sRGB and show the picture washed out.

This adds a small ICC profile (iCCP, about 4 KB compressed) next to cICP, with BT.2020 primaries, the PQ curve and HDR reference white (203 nits) as the profile's white. An ICC profile has no values above white, so programs that only understand ICC show a correct SDR picture with clipped highlights. PNG's third edition gives cICP priority, so programs that read it keep showing HDR. The pixels, cICP and cLLI don't change, nor does the normal SDR screenshot.

The profile is built in code (gfx/hdr_icc.rs), not stored as a binary file.

Tested

On Linux, with an AW3423DW:

Program Without the profile With it
Chromium HDR, correct Unchanged
Dolphin (KDE) Washed out Correct
GIMP Washed out Correct
FireDragon (a Firefox fork) Not compared directly Too dark
Krita Not compared directly Too dark

FireDragon shows the same file correctly once cICP is removed, so its darkness comes from how it handles cICP, not from the profile. Krita changes the brightness of its whole window a second after loading, with or without cICP, which points at its HDR window handling. Removing cICP isn't an option, because Chromium needs it for real HDR. The profile was checked with Little CMS, and pr_ready --quick passes.

Not tested

I can't test Windows or macOS viewers (Photos, Preview, Photoshop, and so on). The file is the same on every platform, but those programs may treat it differently. If you have one, please compare a new -hdr.png with an older one and say what you see.

Discord re-encodes images for its chat view, and HDR screenshots still look wrong there. This doesn't fix that.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/6251 **Author:** [@senjinthedragon](https://github.com/senjinthedragon) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `hdr-png-icc` --- ### 📝 Commits (1) - [`4fa1a55`](https://github.com/horizon-rust/horizon/commit/4fa1a55b08ae43362f85dd64e8efb495dcc682a1) HDR: screenshots carry an ICC profile, for programs that don't read cICP ### 📊 Changes **3 files changed** (+169 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+9 -8) ➕ `crates/horizon-client-render/src/gfx/hdr_icc.rs` (+159 -0) 📝 `docs/graphics.md` (+1 -1) </details> ### 📄 Description > 🤖 Opened by senjinthedragon's AI agent (Claude Code, Claude Opus 5.5), not by senjinthedragon personally. ## What and why Follows #3152. HDR screenshots are tagged BT.2020 with PQ through PNG's `cICP` chunk. That is correct, but many programs don't read it: they take the PQ values for sRGB and show the picture washed out. This adds a small ICC profile (`iCCP`, about 4 KB compressed) next to `cICP`, with BT.2020 primaries, the PQ curve and HDR reference white (203 nits) as the profile's white. An ICC profile has no values above white, so programs that only understand ICC show a correct SDR picture with clipped highlights. PNG's third edition gives `cICP` priority, so programs that read it keep showing HDR. The pixels, `cICP` and `cLLI` don't change, nor does the normal SDR screenshot. The profile is built in code (`gfx/hdr_icc.rs`), not stored as a binary file. ## Tested On Linux, with an AW3423DW: | Program | Without the profile | With it | |---|---|---| | Chromium | HDR, correct | Unchanged | | Dolphin (KDE) | Washed out | Correct | | GIMP | Washed out | Correct | | FireDragon (a Firefox fork) | Not compared directly | Too dark | | Krita | Not compared directly | Too dark | FireDragon shows the same file correctly once `cICP` is removed, so its darkness comes from how it handles `cICP`, not from the profile. Krita changes the brightness of its whole window a second after loading, with or without `cICP`, which points at its HDR window handling. Removing `cICP` isn't an option, because Chromium needs it for real HDR. The profile was checked with Little CMS, and `pr_ready --quick` passes. ## Not tested I can't test Windows or macOS viewers (Photos, Preview, Photoshop, and so on). The file is the same on every platform, but those programs may treat it differently. If you have one, please compare a new `-hdr.png` with an older one and say what you see. Discord re-encodes images for its chat view, and HDR screenshots still look wrong there. This doesn't fix that. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:26:01 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#6744
No description provided.