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
- 1Files arrive via drag-and-drop or the file picker.
- 2The page sends each file to /hdr-service-worker.js over a MessageChannel.
- 3The worker detects format: PNG, JPEG, GIF, HEIC, WebP, AVIF, or any browser-decodable bitmap.
- 4Pixels are decoded to RGBA and converted to linear light.
- 5Linear values are scaled by gain intensity, creating synthetic HDR capacity.
- 6A gain map is computed against a Reinhard-tone-mapped SDR base image.
- 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.
| Name | Full form | Platform | What it means |
|---|---|---|---|
| EDR | Extended Dynamic Range | Apple | Apple's system for displaying brightness above normal SDR white |
| XDR | Extreme Dynamic Range | Apple | Apple branding for displays with high HDR brightness and contrast |
| Adaptive HDR | Adaptive High Dynamic Range | Apple | Gain map image system that supports both SDR and HDR display |
| Ultra HDR | Ultra High Dynamic Range | Google and Android | Gain map JPEG format and the closest Android equivalent to an EDR JPEG |
| Super HDR | Super High Dynamic Range | Samsung | Samsung branding for HDR photo capture and display |
| ProXDR | Pro Extreme Dynamic Range | OPPO and OnePlus | Branding for HDR photo capture and display |
| Pro HDR | Pro High Dynamic Range | Xiaomi | Branding for brighter HDR photo display |
| Advanced Color | Advanced Color | Microsoft Windows | Windows system covering HDR, wide color gamut, and higher color precision |
| HDR | High Dynamic Range | Industry standard | Content with a wider brightness range than SDR |
| SDR | Standard Dynamic Range | Industry standard | Traditional display brightness range |
| WCG | Wide Color Gamut | Industry standard | A broader range of reproducible colors |
| HDR10 | High Dynamic Range, 10 bit | Industry standard | Static metadata HDR format using 10 bit color |
| HDR10+ | High Dynamic Range, 10 bit Plus | Samsung and others | Dynamic metadata HDR format |
| HLG | Hybrid Log Gamma | BBC and NHK | HDR format commonly used for broadcast television |
| PQ | Perceptual Quantizer | SMPTE | HDR brightness transfer function used by HDR10 and Dolby Vision |
| DV | Dolby Vision | Dolby | Dynamic metadata HDR format |
| DisplayHDR | VESA Certified DisplayHDR | VESA | Display performance certification rather than an image format |
| HDR gain map | High Dynamic Range gain map | Cross platform | General 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.