Skip to main content

ReShade With HDR JPEG XL Support

So I have been fiddling around with ReShade for quite some time, trying to give it a capability to capture screenshot in JPEG XL format. However I was kind of stuck in Visual Studio's dependency hell when trying to integrate libjxl to ReShade build system rather than tinkering with the implementation. Well, to be fair, Visual Studio is not my IDE of choice and I have little experience with it, so...

Fast forward 10 months later, I just realized that ReShade already have HDR support and already incorporating HDR PNG as a screenshot format. This tickles my mind to continue experimenting with JPEG XL support again. Furthermore, I just found out that libjxl team also releasing simple-lossless-encoder demo that can fit on a single cc file, this is perfect as this can keep ReShade binary size low and shouldn't complicate the deps, plus I also focused on lossless side for a fast encode (effort 1).

After stealing adapting the demo code, adding few paths to allow few other color profiles (2020 PQ and linear sRGB) and float bitdepth, it finally lives! HDR screenshot with JPEG XL!

HDR Comparison

For a proper HDR viewing, you should view these with HDR (and JXL) enabled browser and HDR monitor

PSO2NGS HDR JPEG XL
JPEG XL - 5.49MB

And here's the PNG one for the comparison:

PSO2NGS HDR PNG
PNG - 8.78MB

Not only that it's smaller than PNG, it also encodes much faster:

HDR Speed comparison

It seems like in HDR PNG they do some color conversion that contributes to that heavy processing, while in JXL I only did buffer conversion (R10G10B10A2 to R16G16B16) without scaling, preserving 10 bit values 0-1023.

SDR Comparison

PSO2NGS SDR JPEG XL
JPEG XL - 4.41MB

And here's the PNG one for the comparison:

PSO2NGS SDR PNG
PNG - 5.38MB

They're pretty similar in speed!

SDR Speed comparison

As for the source code, it's still a draft with a bunch of debug prints enabled, but feel free to check here: https://github.com/kampidh/reshade/tree/jpegxl-simple

I also have prebuilt binaries in case of someone want to test it: self hosted link

PS: Do take a lot of precaution when downloading binaries please, as this is NOT an official build and might have bunch of nasty bugs. You also probably should only test it on a single-player game. Use at your own risk, thank you~

PPS: Upon closer inspection, HDR JXL images above have off-by-one pixel offset due to my buffer conversion fault... If you happen to download the broken one, please redownload it again from the same link above, as I've updated it.