Add JPEG XL screenshot capture to gamescope#2068
Open
0fbcb238c0 wants to merge 5 commits intoValveSoftware:masterfrom
Open
Add JPEG XL screenshot capture to gamescope#20680fbcb238c0 wants to merge 5 commits intoValveSoftware:masterfrom
0fbcb238c0 wants to merge 5 commits intoValveSoftware:masterfrom
Conversation
…ed together with AVIF.
…ix bHDRScreenshot logic. Add temporary time measuring to the AVIF encoder for speed comparison
|
Maybe it would make sense to make JXL the default since it seems to do better on all metrics (size and speed)? If Microsoft is able to get away with making the only HDR screenshot format on Windows be JXR which is a format that has wayyy less support across software compared to AVIF and JXL despite being around for much longer then I personally see no widespread issue from making JXL the default here, Though I guess in the end that's up to the maintainers. |
3v1n0
reviewed
Jan 26, 2026
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.
This PR adds a JPEG XL encoder and an option to select the image format used in screenshot capture.
The user can choose between AVIF (default) and JXL via the --screenshot-format parameter.
A JXL decoder was recently included into chromium and will land in stable in a few weeks.
Mozilla is working on including the same JXL decoder into Firefox.
Windows, macOS and Linux all have support for JXL.
JXL allows for the same HDR capture as AVIF, while being faster to encode and offering greater density.
I have previously compared AVIF to JXL in #1525.
In gamescope JXL encode at effort 2 is 2-4 times faster than AVIF.
At this effort it results in smaller filesizes and is still faster than AVIF, which uses AVIF_SPEED_FASTEST.
Theoretically, since JXL is faster and denser than PNG as well, JXL would be able to replace both entirely in gamescope at some point in the future.
Similar to AVIF, the JXL will always be 10 bit and lossless.
JXL also supports higher bit depths than AVIF, making scRGB 16 bit float capture theoretically possible.
A small selection of games I've compared AVIF and JXL in (1920x1080):
Deep Rock Galactic
Factorio
Holocure
To get the encode time I measured from start of the encoder to after the file is written. This code is still included at the moment, but can be removed.
The comments can be removed later, I just added them to explain some of the new code.