Understanding the Radiance HDR File Format
The Radiance HDR (RGBE) format, originally developed by Greg Ward for the Radiance rendering system, is one of the most widely adopted formats for storing high dynamic range images. Unlike standard dynamic range (SDR) formats that restrict color values to 8 bits per channel (0 to 255), HDR encodes color values as floating-point numbers. A standard Radiance HDR file contains:
- Text Header: Starts with
#?RADIANCEor#?RGBEand contains metadata such as the pixel color format identifier (e.g.,FORMAT=32-bit_rle_rgbe) and exposure commands. - Resolution String: Defines the rendering orientation and dimensions, typically formatted as
-Y height +X width. - RGBE Pixel Stream: Encodes Red, Green, Blue, and a shared Exponent component in 4 bytes per pixel, preserving fine details in both dark shadows and bright highlights.
RLE Scanline Compression in RGBE Files
To maintain a compact footprint, Radiance HDR implements a dedicated run-length encoding (RLE) scheme on a scanline-by-scanline basis:
- Each compressed scanline starts with a 4-byte marker:
[2, 2, (width >> 8) & 255, width & 255]. - The four color channels (Red, Green, Blue, Exponent) are separated and compressed individually rather than interleaved.
- Runs of identical bytes are packed using a count byte ($>128$), while unique byte sequences are written directly with their length. This structure reduces files sizes significantly while ensuring lossless decoding.
SDR to HDR Conversion: Exposure & Gamma
When converting standard dynamic range pictures (PNG/JPG) to HDR, sRGB colors are normalized to floating-point values. An exposure multiplier slider allows you to scale the luminance values of the output, simulating HDR capture. Applying gamma correction ensures that colors scale non-linearly, keeping shadows clear and highlights from blowing out.
Actionable HDR Integration & Best Practices Checklist
1. Keep Aspect Ratio Locked for Resizing
Lock the aspect ratio when scaling textures to preserve the correct shape of assets inside game engines or rendering environments.
2. Choose Color Space Wisely
Use Linear sRGB color space mapping to reverse gamma curves before encoding, which is optimal for physical lighting systems.
3. Blend Alpha Channels
Since Radiance HDR does not support alpha transparency, use the background picker to blend transparent PNG borders into a solid backdrop.
4. Secure Client-Side Execution
All data processing is performed directly on your local device. No images are uploaded to any external server.
HDR Specifications
image/vnd.radiance
Radiance HDR (RGBE format).
32-bit High Dynamic Range (R, G, B channels with shared Exponent).
Adaptive scanline run-length encoding (RLE).
Why HDR?
Radiance HDR is standard in 3D computer graphics pipelines, physically-based rendering (PBR) workflows, game engines like Unreal Engine and Unity, and environment lighting setups (reflection and skybox domes).