Lately, I have been experimenting with “display HDR” photography¹, i.e. producing files which, when viewed with a compatible viewer and a compatible display, produce an image with a potentially much higher contrast (and larger gamut volume) than what is achievable with a SDR display or a SDR format like JPEG.
¹Yes, we need a better (and more easily searchable) name for that, that distinguishes itself from what is usually referred to as “HDR photography” i.e. HDR tone mapping. I await your suggestions!
As we will see, this can lead to images that look much more natural and pleasing to the eye than the “SDR” images to which we are used to. This is not very surprising since the human eye can perceive a much wider range of luminance and colors than what a SDR display can reproduce.
I got interested in this topic after viewing some HDR videos on the mini-LED iPad Pro last year. The device left quite an impression on me, and since then I have been wondering how I could leverage this technology for displaying photos. I do not print much, therefore a monitor (or a projector) is a perfectly reasonable output medium for me, and I don’t need to limit my edits to the limited dynamic range of paper.
A few months ago, I came across this post by @paulmiller on PlayRaw, where he showed that the built-in Preview app in macOS was able to trigger the HDR mode when opening .exr
or .hdr
files. Since I was getting a mac to replace my old, dying laptop, I decided to give it a try.²
²This should probably work too with any recent HDR-capable laptop and a compatible viewer. An open-source viewer for EXR files, that supports 10-bit HDR, is tev. I found it a bit glitchy, but it otherwise worked.
Requirements:
In order to produce and view an HDR image, we need the following things:
-
An input file capable of representing a scene with a high dynamic range. I am using images captured using a Nikon Z6 (which has a dynamic range of about 14 EVs) and exposed “to the right” (or close) in order to preserve highlights. This should be plenty of dynamic range already. For more dynamic range, one can create a .dng from multiple bracketed exposures.
-
A RAW processing software that can handle HDR data. The scene-referred workflow in Darktable works fine, however I could not get filmic to work so I had to disable this module. (But this could just be my fault since I am not very familiar with it.) Importantly, the processing pipeline must not truncate RGB or luminance values which are above 1.0.
-
A file format that can store HDR data. Depending on the specific format and color space, this can involve RGB values above 1.0, an extra exponent E, or a different electro-optical transfer function (like the PQ curve). The experts here can probably explain this much better and accurately than I can. Here I will be using the EXR format (which stores RGB values using 32-bit floats) and the linear Rec2020 RGB color space.
-
An image viewer that can leverage the full dynamic range of the display in order to display the HDR image. I mainly use macOS Preview, but
tev
also works. -
A display which can show HDR content. I will be using the built-in display of the 2021 16’’ MacBook Pro, which has a maximum luminance of 1600 cd/m² (= nits). The SDR luminance (corresponding to (r,g,b) = (1.0,1.0,1.0)) can be set to anything from 48 cd/m² to 500 cd/m² depending on the viewing conditions and how much headroom we want (e.g. for 100 cd/m², the headroom is 1600/100 = 16, i.e. the display can show highlights up to 16× brighter than the “diffuse white”). Note that you cannot obtain fully saturated colors at the highest luminance levels. See this post on AVSForum about color volume for more details.
How to process a RAW file for HDR in Darktable:
Here is a step-by-step guide for producing a HDR .exr
file in Darktable, starting from a RAW file. I have not yet tested how the more “creative” modules work with HDR, so for now I will aim for a very natural look. As you will see, this is surprisingly easy.
For reference, I am using Darktable 3.6.1 for macOS (x86), installed using Homebrew.
-
The first step is to disable any module that performs dynamic range compression, such as filmic (in the scene-referred workflow) or the base curve (in the display-referred workflow).
Here is a good starting point:
-
It is best to use an image which is exposed to the right (ETTR), i.e. its histogram should reach “just before” the right-side of the plot.
-
This is quite good! -
This is still okay: some highlights are clipped, but these are specular highlights, and it is not always possible to preserve them with a single exposure. The bulk of the image is not clipped. -
This is fine too, but suboptimal: you are wasting some of the precious EVs you paid for when buying your camera. -
This is bad. Highlights are clipped and cannot be recovered. “Flat” highlights with no details won’t look good in HDR.
-
-
Then, apply all corrective modules (lens correction, white balance, highlight reconstruction, astrophoto denoise, etc…).
-
Now comes the tricky part: adjusting the exposure. This is tricky for a number of reasons:
- First, Darktable 3.6 currently cannot display pixels with luminance > 1.0 in the image preview (the situation is even worse on macOS, where the preview is limited to sRGB due to a longstanding “impedance mismatch” between the Cairo and macOS APIs). This means that we are basically blind when working on the image. A workaround is to export often and use an external viewer for assessing the result.
- There is a more fundamental issue: Even a peak display luminance of 1600 cd/m² is not enough to reproduce the absolute luminance of the captured scene, which can easily reach tens of thousands of cd/m² (see e.g. this Wikipedia article). Not that it would be desirable, unless we want to burn the viewer’s retinas with our sunset pictures The situation is even worse for saturated highlights, since the display cannot reach its peak luminance.
So, like in the SDR case, we need to perform dynamic range compression. But, unlike in the SDR case, we do not necessarily need to do it ourselves (unless we want full control over our image). For instance, the macOS Preview app seems to apply some reasonably-good tone mapping when loading the image. Since the filmic and RGB curves modules do not seem to be HDR ready yet, here I will take the lazy approach of just applying a global exposure correction, and leave further tone mapping to the image viewer. - We still have a problem: We need to uniformly scale the scene luminance in order to make it fit into the target display’s luminance. But how do we choose the scaling factor? We cannot directly use Ansel Adams’ zone system since there is no “pure black” or “pure white” anymore, nor is there “ink black” or “paper white”, and HDR preserves a lot of texture in both shadows and highlights, making it difficult to define zones I–II and VIII–IX. I guess colorists working for the movie industry probably have some solution to this, but I am not very familiar with their work. As a workaround, what I currently do is choose some “reasonable” SDR brightness (I have created presets for 48, 100 and 160 cd/m²) that still gives enough headroom, and map the typical scene luminance to this value, taking into account the lighting conditions (daylight, shade, night) of the scene. At the very least, this ensures that the relative luminances of the pictures in my “virtual slide tray” are consistent.
In order to obtain consistent luminances between pictures, I have found useful to enable the “ISO 12646 color assessment conditions” (the little lightbulb at the bottom right of the image preview: ).
I then adjust the exposure slider until the main subject looks correctly exposed (taking into account the lighting conditions of the scene), without thinking about the highlights. Its luminance should be “of the same order” as the white border. Note that this will create massive gamut clipping in the preview image! This is because Darktable cannot currently display extended luminance values. With a bit of practice, the gamut clipping indicator can actually become convenient for precisely adjusting the exposure, since it effectively shows which part of the image is above the SDR brightness.
This is how the image preview looks, with and without the clipping indicator:
In this example image, I chose to map the clouds to extended luminance values (> 1.0), while the reflection remains entirely in the SDR range.Spoiler: this is how the final image will look in Preview:
As you can see, the sky isn’t actually clipped.Note that when exposing to the right and processing for HDR, the exposure correction can easily be large (e.g. +5 EV). The picture above is far from being an extreme example.
At this point, the history stack would typically look like (possibly in a different order):
-
The last step is to export our photos to a HDR-compatible format. As we will see, the lack of compatible formats and viewers is currently (in my opinion) the main bottleneck which makes distributing HDR images difficult. As discussed above, I will be using the EXR format. This is a lossless, floating-point format, which allows for a huge dynamic range (more than we probably need for photography) at the cost of producing very large files. The Radiance HDR format
.hdr
seems to be more space efficient, but it does not seem to be supported in Darktable.
Here are the options that I use for exporting to EXR:
Results
Here are some sample EXR files, which I have produced using the above method. Even if you only have a SDR monitor, you may be able to play with the exposure slider in the tev
viewer to assess their dynamic range. These are not necessarily the best pictures, but they are good examples in the sense that they take advantage of the additional dynamic range allowed by the EXR format.
_DSC0576.exr (6.7 MB)
_DSC0942.exr (6.7 MB)
_DSC1087.exr (9.0 MB)
_DSC1645.exr (9.0 MB)
_DSC4195.exr (9.0 MB)
_DSC5433.exr (9.0 MB)
_DSC5464.exr (9.0 MB)
In order to save storage space, you may want to reduce the resolution when exporting. But who doesn’t like to view their pictures in glorious 6K HDR?
Well, you storage device, or anyone you plan to send this picture to, might not like it… Because a 24MP EXR image weights no less than 300 MB. This is 10× more than the actual RAW file! I actually had to rescale the above pictures heavily in order to avoid hammering the pixls.us servers.
Storage
This brings us to the main issue with HDR images. There is currently no efficient file format with widespread support. EXR and Radiance HDR are old and heavy but are supported by some viewers which can take advantage of HDR displays, while HEIC and AVIF have limited support on some platforms and are derived from video codecs which are not optimized for stills. After reading about the different formats, it seems to me that our best bet might soon be the JPEG XL (.jxl
) format, which is optimized for stills, backward-compatible with JPEG, and isn’t patent-encumbered. However, it just got standardized (the standard should be published this month). But there is already beta support in Firefox (without HDR, it seems), Chrome, Facebook, and some big names like Adobe have expressed interest. This is definitely a format to keep an eye on as far as HDR photography is concerned.
(If you are an Apple user, please use this form to request support for JPEG XL in macOS and state that you are a photographer. You can probably select “Finder” as feedback area. The more users pester them, the higher the chance that they end up implementing it, especially since it is not patent-encumbered.)
Final thoughts
From a photographic point of view, these very preliminary experiments have shown me that HDR can actually produce very natural images, with comparatively little effort (no need to stuff the entire dynamic range of the scene into that of an SDR display). And for me less editing = more time outside taking pictures. Of course, I did not even touch on the creative modules of Darktable, since many of them do not seem to have the controls to work with HDR images yet (although the plumbings should work as long as we use the scene-referred workflow). For instance, I cannot add control points above 1.0 in the RGB curve, and its axes are not logarithmic.
Of course, not all scenes, nor all artistic intents, will benefit from HDR. In some cases, it can even be detrimental: think about some distracting highlights in the corner of an otherwise well-composed shot. If the image is processed without dynamic range compression, this would attract the viewer’s eyes like UV light attracts bugs, and it could detract their attention from the main subject. I also expect that some instagrammers will see this new technology as a good opportunity to push the contrast to 1000% and burn our retinas (or worse: 1000 nits blinking ads). So, as always: this is one more tool for photographers, that needs to be used wisely, but this is a particularly powerful one, especially for landscape photographers.
Something I haven’t had the time yet to experiment with, is producing HDR images from multiple exposures (i.e. remaster some old tone-mapped HDRs to take advantage of the larger dynamic range of HDR displays). In particular, since the MBP display is advertised with a contrast ratio of 1000000:1 (= 20 EV) thanks to local dimming, it naively seems that a single exposure cannot fully exploit its dynamic range (although there might be some technical limitations which I am not aware of). So far, I have tried exporting to EXR an old DNG produced in Darktable from 3 bracketed exposures, but the result looked surprisingly flat.
To finish, I would like to invite you to experiment with HDR in Darktable (or your favourite FOSS editor) if you have some compatible hardware. In particular, I would be interested to see if there exist other combinations of file formats and viewers (FOSS or not, on PC or phone, etc…) which can successfully display HDR stills. I would also like to see which Darktable modules already work (or can be made to work) with HDR.
Finally, if you have any tips on how to consistently grade HDR images, I will happily listen
All the images from the present post are released under the CC0 license.