“Gain maps” make HDR look great on any screen

HDR support has rapidly improved since Adobe first added support for true HDR (High Dynamic Range) display last October. We finally have the tools to show the full dynamic range and color captured in our RAW images. If you haven’t seen it, you won’t believe what you’ve been missing. Even 20 year-old RAW files can show detail that was never before visible. The biggest remaining challenge has been to find a way to support enhanced HDR display while still ensuring our photos look great on plain old SDR (Standard Dynamic Range) monitors. And now we finally have the solution: gain maps.

Note: To confirm what level of HDR support your computer has, please see test #1 on my HDR page.

What’s the benefit of an HDR “gain map”?

A simple HDR photo (one without a gain map) will often look mediocre at best on an SDR monitor. In that scenario, the browser uses “tone mapping” to convert from your HDR to an SDR image. Such a fully automated process doesn’t understand the creative decisions you would make a specific image to manage color, contrast, etc when compressing the tonal range. The automated results are almost never as good as the SDR image you could create on your own.

An HDR “gain map” gives you control over both the HDR and the SDR version – rather than leaving it to some fully automated process. It allows you to share photos which look amazing on any display, regardless of whether it supports HDR or not. So there is no longer a penalty for sharing HDR – everyone who views your image sees either a gorgeous HDR or a beautiful SDR – but never some low-quality tone map. If you want to see several examples, take a look at my HDR gain map gallery.

This means gain maps are also a critical technology to help spur adoption of HDR. We no longer have to wait for everyone to get HDR displays to start sharing HDR photos. And the best news is that it is available now. The majority of web browsers already support it, and it is backwards compatible so browsers that don’t support it simply fall back gracefully to your SDR image.

Another advantage of gain maps is that they eliminate tone mapping. There is no browser-specific algorithm that converts a full range HDR to a lesser HDR or SDR image. The gain map includes an exact SDR and HDR image. If your monitor is HDR but lacks the headroom to render the HDR as it was created, then an intermediate image is interpolated from the SDR and HDR versions. So it will look much better than tone mapping and it will be consistent from one browser to the next.

Note: This is an HDR video. It will look dark and lower contrast on an SDR display due to tone mapping of the video itself. Also, while the HDR video is pretty decent, it is not identical to viewing my actual screen (due to the greater complexities of HDR video – Adobe should truly be commended for how simple they’ve made HDR photography). If you view the gain map photo below on Chrome/Edge/Brave/Opera and an HDR display with 3 stops of headroom, you will see an exact match to what I see in Photoshop. Do not view on Firefox (seems to show incorrectly on HDR displays).

 

How does a gain map work?

A gain map is a single file with a second pseudo-image embedded in it to create an optimized result for a specific monitor. It can be used to generate the HDR version (which looks dramatically better where supported), the SDR version (without tone mapping to ensures great quality), or anything in between (to better support less capable HDR displays).

Gain maps are not a new type of file, but rather a technology which can be embedded into a variety of image formats. There are reference specs already for the JPG, AVIF, JXL, and HEIF file formats. JPG is especially notable as it could not properly support HDR without gain maps and it offers a very useful bridge to the future (i.e. highly compatible with today’s software).

A gain map includes:

  • A base (default) image. This can be an SDR or an HDR image (JPG gain maps are always encoded with SDR as the base). If the browser or viewing software does not understand gain maps, it will just the treat file as if it were just the base image.
  • The gain map. This is a secondary “image” embedded in the file. It is not a real image, but rather contains data to convert each pixel from the base image into the other (SDR or HDR) version of the image.
  • Gain map metadata. This tells the browser how the gain map is encoded as well as critical information to optimize rendering on any display.

How a JPG gain map is displayed depends on your software/hardware:

  • If your display supports HDR and your browser supports gain maps, you will see the HDR version of the image.
  • If your display is SDR, you will see the SDR version of the image.
  • If your browser  does not understand JPG gain maps will simply show you the SDR base image. So, JPG gain maps are backwards compatible and safe to use with any browser.

Note: you may see JPGs with a gain map called “Ultra HDR JPG“. Adobe does not use this brand name, but Google (Android 14) does. 

In the future, we will have options for other formats or the ability to encode with HDR as the base image. That will offer benefits for file size and quality, but is not 100% compatible with current browsers. JPG gain maps are the way to go for now.

 

Which browsers full support gain maps?

There is already widespread support for JPG gain maps. Chrome (v116+), MS Edge (v116+), Brave (v1.58+), and Opera (v102+) all support it by default. Collectively, that will represent about 75% of web usage soon (once a little more time has past for users to update to the latest version). If Safari were to add support, we’d get to 95%. So it’s already close to a default standard, but there is no reason not to use it now. JPG gain maps are backwards compatible, which just means if you use Safari to view an HDR JPG on an HDR display, you’ll see the SDR version because Safari doesn’t yet understand the image. So you can safely share HDR JPG gain maps now.

You can confirm support for gain maps in your browser by reviewing these HDR tests on a display which supports HDR. Below are three versions of the image. One is a true gain map (and will show as SDR or HDR based on your setup), one shows the ideal SDR rendition you’ll get from the gain map, and the last shows the inferior tone map SDR you’d get if a simple HDR without a gain map were viewed on an SDR display. If you have an SDR display, the gain map and SDR version from it should match.

 

 

How do you create a gain map?

Adobe Camera RAW v15.5 added support to create JPG gain maps. Just follow these steps:

  1. You’ll need a single layer to export, create a “stamp visible” layer by clicking <ctrl/cmd><alt/option><shift>-E.
  2. If you need to crop the image, you should instead probably just create a flattened copy of the image and crop that (Image / Duplicate).
  3. Select the new layer and run Filter / Camera Raw Filter (<ctrl/cmd><shift>-A).
  4. Make sure “HDR” mode is enabled (probably off by default). If you don’t see this option, your source image is not 32-bits (which is required for HDR export).
  5. Turn on “Preview for SDR Display” and tweak the settings as desired. This gives you direct control over the SDR version of your image saved in the gain map. Consider adding sampler points to monitor highlights so you can push the SDR as far as possible without clipping channels. *
  6. Press <ctrl/cmd>-S or click the save icon at top-right (near the gear icon).
  7. Set format to JPEG and check “enable HDR display“. This requests an HDR gain map. Consider using a slightly higher JPG quality than you normally would, 10 is a good choice but going as high as 12 is beneficial for some images
  8. You can set other setting as desired. Set the color space to “HDR sRGB (Rec 709)” if you plan to share the image on social media or other sites which may reprocess the image (this avoids problems which may be caused if the color profile is stripped from the image during reprocessing). If you are uploading direct to your own site and not using services which reprocess the image, the P3 color space is safe to use and offers better results.
  9. Once you’ve picked settings, click “Save” and exit the raw filter.
  10. Delete the stamp visible layer you created in step #1.

* Don’t expect your SDR to look as good as the HDR, it won’t. That’s the whole point, HDR is vastly better. We’re just trying to make the image look as good as possible on monitors with less dynamic range.

Note that while ACR v15.5 can export JPG gain maps, but ACR / PS will just open the base map (ie reading is not currently supported, so test/confirm your export with a supported browser or by using the Adobe tool detailed below).

 

Web Sharp Pro (WSP) v5.8.4 is designed to help facilitate gain map exports by offering the following benefits:

  • Eliminates most of the steps above (you’ll only need 5, 6, and 9 after your first export). Once you’ve set your SDR preview, just click <ctrl/cmd>-S, <enter>, <enter> to quickly save with the same settings you used last time in the interface – everything else is automated by WSP (I’d make it fully automated if Photoshop offered native support to export gain maps, but this is an excellent first step and easy to manage).
  • Your SDR preview settings are remembered so you can easily re-use or revise them for subsequent exports.
  • It can automatically enhance any SDR image to HDR and then export that as a gain map. This is a great option for those of you who focus primarily on processing for print, but would also like to offer an enhanced HDR version to view on screens.

In addition to simplifying gain map creation, WSP offers a range of other benefits such as social media templates, remembering custom crops, batch exports, adding borders, watermarks, etc.

 

 

What are the limitations of gain maps?

Like most new technologies, not everything is an improvement. The main downside of a gain map is that it is slightly larger than a standard image, typically about 30% larger. That’s a very small price to pay (and in the future AVIF gain maps should offset that change in size). If you need to make things as small as possible for your site, you can always share separate SDR and HDR versions of your image (I have a demo page that does serves SDR / HDR images dynamically instead of gain maps here).

The other limitation of gain maps (with the current tools) is that we don’t have complete control over the SDR version of the image – just a very useful set of global sliders. We can already get excellent results, but allowing the user to provide their own SDR would be an ideal enhancement for the future (to support creatives who want to push their art as far as possible). The gain map spec would allow this, we just need encoding software. If you’d like to see Adobe add support for you to have full control over the SDR rendition, please vote on this feature request.

 

In addition to these limitations, we must be aware that various web services may strip the gain map when we upload images. When you upload to Facebook, Instagram, or to your own WordPress media library, the image is typically reprocessed. Derivative versions of the image may be created to shrink the file size, fit certain size requirements, create thumbnails, ensure the submitted image cannot exploit security vulnerabilities, etc. Unless that back end reprocessing software supports gain maps, the resulting images will be based on the base image. In other words, HDR gain map JPG will just turn into the SDR embedded in your image. It’s perfectly safe, but the HDR benefit will be gone. This is very new technology and it will take time for these websites to adopt support.

There are many options to work around reprocessing issues which may convert gain maps to SDR:

  • WordPress or similar services: skip the media library and upload the images directly to your server. This is what I’m doing on my site.
  • Portfolio websites: use zonerama.com, which automatically serves HDR or SDR images. You can also embed your Zonerama portfolio on your own site.
  • Social media: Share a link to your HDR images, perhaps alongside the SDR image and a note to explain that the link shows the enhanced HDR version.
  • Email: send a ZIP or a link to the images on a service like DropBox and Google Drive (note that your file preview may be converted to SDR, but the actual download should be your original gain map).

I recommend you contact support as appropriate for any important services you use to let them know HDR is important to you and that you’d like to see support for HDR gain maps. Consumer demand will determine how quickly we see support.

It can be a little confusing when you create a proper gain map and then later find it was converted to SDR. The results can also be mixed (such as showing SDR for the preview on a service like Google Drive, but the download still providing the original gain map with HDR). Or you may still HDR while composing a post (such as on Reddit), only to find the post shows as SDR after being submitted. I recommend you test your uploads to make sure you know they still display as HDR. You can also download them and review in the Adobe Gain Map Demo App as detailed below.

 

What’s next for gain maps?

I am incredibly grateful to the various industry partners who have collaborated to bring us such an immensely useful innovation for photography. The initial support is incredible and there is so much opportunity to take things even further. We will likely see improvements in gain maps for years to come. Even when HDR screens are everywhere and SDR becomes rare, they will have an important role to play in adapting the best content to lesser HDR screens or for managing display in bright conditions (such as viewing your phone on a sunny day). I’ll offer my thoughts here on some enhancements we may see in time.

We also only have limited control over the SDR rendition at this time (through the preview sliders). That’s amazingly useful and easy to use, but a complete and optimal solution would also offer the user full control by supplying their own SDR (i.e. full manual control over the SDR). This would allow unique RAW process, local adjustments (such as tweaking just the sky), etc for the best possible results. It would also greatly facilitate creating enhanced HDR images from print-ready SDR images. If Photoshop were to add scripted support to create gain maps with full control over both the SDR and HDR version of the image, we’d truly have the ultimate tool for sharing HDR images that are optimized everywhere.

JPG gain maps are a very important first step as they offer universal support and backwards compatibility. However, other formats will be preferable in time. The most exciting is AVIF gain maps. These are already supported in Chrome Canary (under a developer flag chrome://flags/#avif-gainmap-hdr-images), however we need an encoder and more browser support before they are ready for general use. AVIF gain maps offer many benefits over JPG gain maps:

  • ~30% smaller files
  • Higher quality than JPG (fewer artifacts and 10-bit encoding to avoid banding)
  • The base image can be encoded as HDR, which offers better HDR quality and potentially even smaller files (as it’s probably safer to use low resolution gain maps if the base image is HDR). This won’t be an ideal format to share until gain map support is more widespread (otherwise you may see tone mapping or clipping based on the HDR rather than proper use of the gain map on displays which lack the full HDR capacity required for the HDR image).
  •  Supports transparent backgrounds

JXL also supports gain maps and could potentially offer further benefits for photography over AVIF in some cases. For example, it can encodes at higher bit depths than AVIF (which may make them suitable for further editing). The gains here are not as significant as AVIF vs JPG, and browser support for JXL is fairly non-existent. It is unclear if it will be gain widespread support.

Currently, we only have an option to create gain map through ACR (as far as I’ve seen to date). Expanding native support to Photoshop (PS), Lightroom (LR), Affinity, and other popular photography editing applications will obviously benefit creators. An increasing number of options in time is inevitable, the benefits will make gain maps very popular.

The current gain map spec is not yet an ISO standard, but efforts are in progress. An official standard should help ensure consistent quality across different browsers and software (although things already seem pretty solid).

 

Proofing and testing with the Adobe “Gain Map Demo App”

Adobe has built a demo tool intended to help software developers add support for gain maps, but it is also very useful for photographers who wish to test their images and better understand how gain maps work.  The Gain Map Demo App and sample images are available here and demonstrated in the video above. This gets a bit technical and is completely optional, but can be helpful for those who want to understand gain maps more deeply. It also demonstrates how important gain maps are if Adobe is willing to build a tool like this.

Some helpful tests you might run using this app:

  • Confirm an image is a proper gain map: The text in the right-hand column will tell you if you have an SDR or HDR image and whether it has an embedded gain map. This offers a very clear way to confirm that your image was properly created as a gain map, or that it remains so after uploading to a website.
  • Soft proof how your HDR will look on other monitors: When viewing “adaptive”, you can change HDR capacity to “manual” and drag the slider to see how the gain map will be rendered on displays ranging from SDR to the HDR capacity offered by your display. Watchout: if the image contains HDR detail above the actual capacity of your display, moving the slider above your HDR headroom will show clipping in the highlights (whereas a web browser would never do this because it would use the automatic version at the limits of your display). So don’t push the slider beyond your current limits (you can determine your HDR headroom using test #1 on my HDR page).

Some tips for using the app:

  • Drag an image to the app icon to open it directly (only works if the app is not already running).
  • To open multiple images, right-click the filmstrip area and choose “add image”.
  • Don’t worry if you see minor glitches or don’t understand the rest of it. It is just intended as a demo for software developers, not as a polished product for use by photographers.

Note that the app has other detail and viewing modes, but it goes down a pretty deep technical rabbit hole that I’m going to skip here because it isn’t helpful or meant for photographers. The reference documentation and spec at the link provides above more details for software developers.

 

More information for developers:

We have great tools to create and view gain maps, but also need 3rd-party tools which reprocess images to support gain maps so that we can safely share these JPG gain maps through media libraries on the various web platforms we use (otherwise the gain map we upload is converted to a standard JPG with no HDR support). The following resources should be helpful for developers looking to understand HDR or gain maps:

Greg Benz Photography