Technical document

What Gainmaps actually does to an image

A gain map image carries two things: a standard SDR baseline every app can open, and a secondary brightness layer (the gain map) that HDR displays use to expand highlights past SDR reference white. Gainmaps synthesizes that second layer locally, in your browser, from the pixels you give it.

What changes

The worker rasterizes your photo, builds linear HDR capacity from the SDR pixels using the chosen gain intensity, tone-maps an SDR base, and writes a single gain map image. The output file is larger than the input: it carries both the SDR image and the gain map, but opens normally in any JPEG viewer.

This is not camera-scene HDR reconstruction. Without original HDR capture data, the tool synthesizes headroom from the SDR image. Compatible viewers (Apple Preview, Photos, Android Ultra HDR clients) can then expand the gain map on capable displays.

Pipeline

  1. 1Files arrive via drag-and-drop or the file picker.
  2. 2The page sends each file to /hdr-service-worker.js over a MessageChannel.
  3. 3The worker detects format: PNG, JPEG, GIF, HEIC, WebP, AVIF, or any browser-decodable bitmap.
  4. 4Pixels are decoded to RGBA and converted to linear light.
  5. 5Linear values are scaled by gain intensity, creating synthetic HDR capacity.
  6. 6A gain map is computed against a Reinhard-tone-mapped SDR base image.
  7. 7The result is encoded as an Ultra HDR JPEG Blob and returned for download.

Formats

Input: PNG, JPEG, WebP, AVIF, GIF (first frame only), HEIC when the browser decoder can open it, and SVG including animated SMIL/CSS SVG. Animations are frozen to a keyframe, then encoded.

Output: always a gain map image (*-gainmap.jpg). The file contains both layers and can be opened by any standard JPEG viewer.

Gain

Gain is the maximum HDR/SDR brightness ratio encoded into the photo. The default mid setting targets roughly 3.34×, similar to many iPhone HDR stills. Lower values are subtler; higher values push brighter highlights on HDR displays.

The nav Ultra switch controls CSS dynamic-range-limit for the whole page: Off clamps to SDR reference white; On unlocks Ultra photos and color-hdr() accents on capable displays. See how it looks on the Ultra text demo →

Names

Vendors, platforms, and standards each coined their own name for the same idea: brightness above SDR reference white, encoded so every app can still open the file.

On a Mac, when the display raises brightness to show an HDR image, that path is Extended Dynamic Range (EDR). EDR is Apple's way of displaying brightness above SDR reference white. HDR describes the image content. They are not the same word, and they are often used interchangeably by mistake.

An EDR JPEG is possible: it is usually called an HDR JPEG with a gain map. The file holds a normal SDR JPEG plus extra brightness data. Unsupported apps show the SDR layer. Editing or reexporting the image may strip the map. Apple calls the still-image system Adaptive HDR; Android and Google call the JPEG format Ultra HDR, the closest Android equivalent to an EDR JPEG. The cross-platform technical name is HDR gain map image.

EDR lifts highlights, not the shadow floor. Blacks do not necessarily get blacker.

NameFull formPlatformWhat it means
EDRExtended Dynamic RangeAppleApple's system for displaying brightness above normal SDR white
XDRExtreme Dynamic RangeAppleApple branding for displays with high HDR brightness and contrast
Adaptive HDRAdaptive High Dynamic RangeAppleGain map image system that supports both SDR and HDR display
Ultra HDRUltra High Dynamic RangeGoogle and AndroidGain map JPEG format and the closest Android equivalent to an EDR JPEG
Super HDRSuper High Dynamic RangeSamsungSamsung branding for HDR photo capture and display
ProXDRPro Extreme Dynamic RangeOPPO and OnePlusBranding for HDR photo capture and display
Pro HDRPro High Dynamic RangeXiaomiBranding for brighter HDR photo display
Advanced ColorAdvanced ColorMicrosoft WindowsWindows system covering HDR, wide color gamut, and higher color precision
HDRHigh Dynamic RangeIndustry standardContent with a wider brightness range than SDR
SDRStandard Dynamic RangeIndustry standardTraditional display brightness range
WCGWide Color GamutIndustry standardA broader range of reproducible colors
HDR10High Dynamic Range, 10 bitIndustry standardStatic metadata HDR format using 10 bit color
HDR10+High Dynamic Range, 10 bit PlusSamsung and othersDynamic metadata HDR format
HLGHybrid Log GammaBBC and NHKHDR format commonly used for broadcast television
PQPerceptual QuantizerSMPTEHDR brightness transfer function used by HDR10 and Dolby Vision
DVDolby VisionDolbyDynamic metadata HDR format
DisplayHDRVESA Certified DisplayHDRVESADisplay performance certification rather than an image format
HDR gain mapHigh Dynamic Range gain mapCross platformGeneral technical term for an image containing SDR data plus additional HDR brightness information

Privacy

Files never leave the browser for processing. The service worker encodes locally and returns a downloadable blob. No bytes travel to any server. Closing the tab discards all in-memory results.

The converter works offline after the first load. There is no backend, no analytics pipeline, no upload endpoint.

Standards

Limits

Very large images may be slow to encode in-browser; the worker is single-threaded per file. Animated GIF only encodes the first frame. HEIC decoding depends on platform support. Gain-map appearance varies by viewer software and display peak luminance: the same file looks different on an iPhone XDR versus an SDR monitor.