Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HDRGlow

SDR logo PNG → glowing HDR JPEG for Apple Preview, Safari, Photos, and Chrome.

Turn a transparent logo into an HDR image that literally lights up on HDR displays — the same effect you see in modern brand icons on MacBooks and iPhones.

Tests License: MIT


Quick start

git clone https://github.com/masicmirza/HDRGlow.git
cd HDRGlow
pip install -r requirements.txt

# Recommended on Mac: PNG with Rec.2020 PQ ICC (glows + clean edges)
python main.py logo.png logo_hdr.png --background "#ffffff"

Open logo_hdr.png in Preview or Safari on an HDR display.

Format Glow on Mac SDR edges Notes
.png (default) Yes Best Use this
.jpg (--format retag) Yes Softer JPEG ringing on thin strokes
.heic Often no Good Skip for glow
ultrahdr Often no Sharp Gain map not applied by Preview

Input requirements

Requirement Detail
Format PNG (RGBA preferred)
Background Transparent — the tool composites onto --background
Size Any; use --supersampling 2 for logos under ~200px

Export from Figma / Sketch / Illustrator as PNG with transparency.


Usage

# Minimal (recommended for most logos)
python main.py input.png output.jpg --background "#36185A"

# With edge cleanup
python main.py input.png output.jpg --background "#36185A" --remove-noise

# Inspect an HDR JPEG
python main.py inspect output.jpg

# Compare multiple peak-brightness targets
python main.py test-outputs input.png --output-dir ./test_outputs

Options

Flag Default Description
--background #000000 Background colour under transparency (hex)
--format png png (glow + clean edges), retag (JPEG glow), heic (often no glow), ultrahdr, pq
--quality 95 JPEG quality (1–95)
--remove-noise off Strip near-white fringe pixels on alpha edges
--enhance-edges off Unsharp mask for sharper logo edges
--supersampling N 1 Upsample small logos by N× before processing
--brightness 3.0 Linear luminance boost (pq / apple only)
--white-nits 1000 Peak white in nits (pq / apple only)
--contrast 1.15 Contrast (pq / apple only)
--saturation 1.08 Saturation (pq / apple only)
--gamma auto Gamma correction (pq / apple only)
-v off Debug logging

Formats

Format What it does Best for
png (default) sRGB pixels + Rec.2020 PQ ICC in a PNG Mac HDR glow + clean edges
retag Same idea as JPEG When you must use .jpg
heic Rec.2020 PQ NCLX HEIC Often no glow in Preview — avoid
ultrahdr Sharp sRGB base + Ultra HDR gain map Android/Chrome gain-map viewers
pq Full linear-light → Rec.2020 → PQ JPEG Professional HDR pipelines

How it works

PNG (RGBA)
  → load + optional cleanup
  → composite onto background
  → export as JPEG with Rec.2020 PQ ICC profile

The default retag mode matches how many real-world HDR brand logos are authored: sRGB codes are stored as-is, and an Apple Rec.2020 PQ ICC profile tells HDR displays to interpret them as PQ luminance — so mid-greys become ~1000+ nits on screen.

Optional modes (pq, apple) implement proper colour-science and gain-map pipelines for later formats (Ultra HDR, AVIF, JXL, HEIC).


Tests

pip install pytest
python -m pytest tests/ -v

Project layout

HDRGlow/
  main.py              CLI entry point
  pipeline/
    loader.py          PNG → float32 RGBA
    compositor.py      Alpha composite + sRGB ↔ linear
    hdr.py             Rec.2020, boost, PQ encoding
    tone_mapping.py    SDR preview operators
    gainmap.py         Gain map computation
    icc.py             ICC profile load / inspect
    export.py          retag / Apple / PQ exporters
  profiles/            Rec.2020 PQ ICC profile
  tests/               Unit + integration tests

License

MIT — see LICENSE.

The bundled ICC profile in profiles/ is an Apple Rec.2020 PQ profile used for display compatibility. Apple trademarks remain Apple’s.

About

SDR Logo PNG → Apple-compatible HDR JPEG

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages