Hi all,
I’ve been editing more and more of my photos for HDR displays lately and have settled on a darktable setup that works well for me. I wanted to share it as a quick start guide, along with the image viewer I’ve been building to look at the results.
The Processing RAWs for HDR displays in Darktable thread has a ton of great background. This is my condensed, practical take using HLG and JPEG XL. Corrections and suggestions are very welcome.
Why HLG and not PQ?
-
PQ export in darktable is broken for this use right now. The PQ profile maps 1.0 to 10,000 nits, so middle gray ends up around 1,800 nits unless you pull exposure down by several stops.
-
HLG is easier to work with. It’s relative rather than absolute, so the display adapts the image to its own peak brightness instead of you targeting fixed nit values.
-
Most camera makers use HLG for their in-camera HDR stills, so the files fit in with what’s already out there.
darktable setup
1. Output color profile
Set the export profile to HLG Rec2020 RGB.
2. Disable sigmoid (or filmic, or AgX)
HLG has a lot more dynamic range than SDR, so tone mapping usually isn’t necessary. A tone mapper would compress the image back down to SDR range, which defeats the purpose. Without one, anything above the top of the HLG range clips, so keep an eye on the brightest highlights.
3. Exposure: -1.05 EV
This places exposure according to the ITU-R BT.2408 guidelines for HLG. The value has two parts:
-
-1.75 EV to account for the HLG transfer function. I measured this with my own Sony body and a ColorChecker.
-
+0.7 EV, darktable’s default compensation for typical raw underexposure.
Since this was measured with my camera, it may not be exactly right for yours or for every situation, just like any default exposure in SDR. In practice I’ve found it works well as a starting point.
4. Expect a dark preview
darktable can’t display HDR yet, so with this setup the darkroom preview looks too dark. That’s expected. Judge the final brightness on an HDR display with a proper image viewer.
JPEG XL export
Why JPEG XL? It has first-party HDR support (HLG and PQ are part of the format itself), and in my opinion it’s the most promising successor to JPEG. As of this month, Chrome 155 and Firefox 158 both decode it by default, joining Safari.
| Setting | Value |
|---|---|
| File format | JPEG XL |
| Bit depth | 12 bit |
| Quality | 98 |
| Encoding effort | 8 |
| Decoding speed | 0 |
| Profile | HLG Rec2020 RGB |
- Quality 98, effort 8, decoding speed 0 for the best possible quality.
- 12 bit. For lossy JPEG XL (quality below 100), darktable hands libjxl float data and the bit depth only sets a header field that tells decoders what precision to expect. 10 and 12 bit give the same file size and quality. Avoid 8 bit though, since some apps then decode to 8-bit buffers.
Metadata
Open the export module’s preferences (hamburger menu) and tick all the checkboxes. For privacy reasons, darktable doesn’t write any metadata to JPEG XL until every box is checked.
Viewing the results: xl-view
To look at these files I’ve been building xl-view over the last couple of months. It’s a small JPEG XL viewer for Linux, Windows and macOS, focused on showing HDR files correctly and staying responsive with large images like panoramas. It’s written in Rust and licensed GPL-3.0.
On an HDR display it outputs PQ, and on an SDR display it tone-maps to sRGB. HLG, PQ and SDR files all work. On Linux it needs a native Wayland session, and HDR also needs compositor support for HDR and Wayland color management.
Builds are on the releases page.
I put a lot of effort into testing and validating the HDR pipeline, but there are many OS, GPU and display combinations out there, so reports are very welcome.
Thanks for reading! Happy to answer questions about any of this.
DSC00564_downscaled_no_metadata.jxl (887.6 KB)
