bvibber / hdrfix

tool for converting HDR screenshots to SDR with suitable tone-mapping
114 stars 10 forks source link

hdrfix - a tool for mapping HDR screenshots to SDR

This is a tool I wrote for my personal usage dealing with HDR (high dynamic range) screenshots of Microsoft Flight Simulator, as taken with Nvidia's GeForce Experience game overlay capture utility which saves a JPEG XR in 32-bit float precision scRGB, and an 8-bit-per-channel PNG with lower resolution information, but encoded with BT.2100 color space and transfer function.

Outputs files as regular SDR (standard dynamic range) PNGs in bog-standard sRGB colorspace. There are a few parameters for adjusting the conversion.

JPEG XR conversion is done with the jpegxr crate, which wraps Microsoft's BSD-licensed JPEG XR codec.

Also works with 16-bit float input as saved from the Windows Game Bar now and 10-bit RGB output from Xbox, however this is less tested.

Author, repo, etc

Dependencies

Installation

From binary release download:

From source checkout:

cargo install --path=.

From crates.io:

cargo install hdrfix

Usage

Basic conversion:

hdrfix screenshot.jxr output.jpg

Watching a folder, converting all newly-added *.jxr files to *-sdr.jpg:

hdrfix --watch=.

Note that an example Windows batch file watch.bat is included with settings for Flight Simulator screenshots, using this mode.

Interactive help!

hdrfix --help

Adjustable parmeters:

Recommended settings

I'm using the current default settings ("hable" tone mapping) for converting screenshots from Microsoft Flight Simulator, which look nice so far. Still tuning it up, so it may change.

Todo / roadmap

Definitely/short-term:

Maybe/later/no rush:

Building

cargo build --release

Requires Rust and Cargo, and a C compiler. On Windows, install Visual Studio Community Edition with C++ development tools or else the command-line build tools. On Linux or Mac there may be some compilation problems at the moment as the jpegxr C library code is still being adapted.

You must install LLVM + Clang to complete a build due to the C code; on Windows you can get a release from https://github.com/llvm/llvm-project/releases/tag/llvmorg-12.0.0 or whatever the current release is. On Linux or Mac, use the system or user-preferred package manager.