Skip to content

Latest commit

 

History

49 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hdr-Gainmap

Generate HDR images (jpeg + Gain Map) optimized for SDR and HDR displays.

Overview

This project is a Python tool for generating HDR Gainmap images in JPEG format, with several workflows available:

  • Combine an SDR image with a true HDR image
  • Combine an SDR image with an underexposed SDR image
  • Generate HDR from a tone-mapped SDR image
  • Create a pseudo-HDR image from a brighter SDR source

Key features:

  • Optimized rendering on both SDR and HDR displays
  • Improved brightness, contrast, and visual impact on HDR screens
  • Built-in presets for better compatibility with platforms such as Instagram

Quick Start

   git clone https://github.com/jb-jrdn/Hdr-Gainmap
   cd Hdr-Gainmap
   uv python install 3.13       # If python is >=3.14
   uv sync

   source .venv/bin/activate    # macOS / Linux
   # .venv\Scripts\activate     # Windows PowerShell

Usage

SDR + native HDR → HDR Gainmap (✅ Recommended)

Combine SDR image (jpg) and native HDR image (avif)

hdr-gainmap --sdr input_sdr.jpg --hdr input_hdr.avif -o output_uhdr_1.jpg
SDR image
input_sdr.jpg
HDR image
input_hdr.avif
HDR image with gain map
output_uhdr_1.jpg

Batch mode:

hdr-gainmap --dir path/to/images/

File naming convention type:

image.jpg
image.avif

SDR + under-exposed SDR → HDR Gainmap

Combine SDR image and SDR underexposed image (with EV value)

hdr-gainmap --sdr input_sdr.jpg --sdrev input_sdr_2ev.avif --ev 2 -o output_uhdr_2.jpg
SDR image
input_sdr.jpg
SDR image - 2EV
input_sdr_2ev.avif
HDR image with gain map
output_uhdr_2.jpg

Tone-mapped SDR → Hdr Gainmap

Increase brighter part of SDR image to create a HDR version

hdr-gainmap --sdr input_sdr.jpg --ev 2 -o output_uhdr_4.jpg
SDR image
input_sdr.jpg
HDR image with gain map
output_uhdr_4.jpg

SDR boosted → Hdr Gainmap

Generate HDR from one SDR image with exposure compensation

hdr-gainmap --sdr input_sdr_2ev.jpg --ev 2 -o output_uhdr_3.jpg
SDR image
input_sdr_2ev.jpg
HDR image with gain map
output_uhdr_3.jpg

Recommended Lightroom Export Settings

  • SDR image:
    • HDR Off in Develop mode
    • Export setting:
      • Image Format: JPEG
      • Quality: 95
      • Color Space: Display P3
      • HDR Output: No
  • HDR image:
    • HDR On in Develop mode
    • Export setting:
      • Image Format: AVIF
      • Quality: 100
      • Color Space: HDR P3
      • HDR Output: Yes
      • Maximize Compatibility: No

Note:

  • SDR and HDR images must have the same image size
  • To use batch mode of this tool, export SDR and HDR in the same folder

📄 License

Apache-2.0 license

About

Python tool to convert SDR + HDR to Ultra HDR with Gainmap

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Contributors

Languages