Skip to content

Add HDR screenshot option - #1149

Open
hamburg3rz wants to merge 3 commits into
mahkoh:masterfrom
hamburg3rz:hdrscreenshots
Open

Add HDR screenshot option#1149
hamburg3rz wants to merge 3 commits into
mahkoh:masterfrom
hamburg3rz:hdrscreenshots

Conversation

@hamburg3rz

Copy link
Copy Markdown

Most likely needs to be cleaned up a little but adds jay screenshot --hdr10 as an option in jay. Closes #1146.

Comment thread src/cli/screenshot.rs Outdated
Comment thread src/cli/screenshot.rs Outdated
Comment thread src/screenshoter.rs Outdated
Comment thread src/cli/screenshot.rs Outdated

let mut out = vec![];
{
if is_hdr10 {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mixes two things:

  1. If the format is XRGB2101010, then we need to do the decoding done in the branch.
  2. If the color description is hdr10, then we need to set the cICP chunk.

These should be handled separately. So the if here should be guarded on buf.format == XRGB2101010 directly. Then the writing of the chunk should be guarded on whether we requested hdr10 from the compositor.

The same chunk check should be added to the else branch.

The else branch should also be guarded on the format being XRGB8888 with an else branch added below that aborts with a fatal error saying that we don't know how to transform the format into PNG.

Comment thread src/cli/screenshot.rs Outdated
Comment on lines +296 to +299
let mut writer = encoder.write_header().unwrap();
// BT.2020 primaries, ST 2084 (PQ) transfer characteristics.
writer.write_chunk(chunk::cICP, &CICP_HDR10).unwrap();
writer.write_image_data(&image_data).unwrap();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this code is now going to be identical for both branches, the if/else should probably return the encoder and the image data, with this code moved out of the if/else.

Comment thread src/ifs/jay_compositor.rs Outdated
@mahkoh

mahkoh commented Aug 1, 2026

Copy link
Copy Markdown
Owner

LGTM otherwise.

@hamburg3rz

Copy link
Copy Markdown
Author

Thank you for reviewing, I'll try my best to fix everything when I have time

@hamburg3rz

Copy link
Copy Markdown
Author

Pushed a new commit which should hopefully be an improvement. Apologies if not, I'm still quite new to git and rust.

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.

HDR screenshots

2 participants