Radiance HDR codec support

August 12, 2026 ยท View on GitHub

This document defines the implemented boundary of the first-party Radiance HDR codec.

Decode

  • #?RADIANCE and #?RGBE signatures
  • FORMAT=32-bit_rle_rgbe
  • Standard per-channel scanline RLE, including 128-byte literal packets
  • Legacy flat RGBE scanlines and legacy repeat packets
  • +X, -X, +Y, and -Y resolution orientations
  • Native rgbf32 output without 8-bit clipping
  • Region decode with bounded scanline buffers
  • XYZE pixel data
  • Multiple pictures in one stream

Metadata

  • Width, height, bit depth, floating-point sample format, and orientation text
  • Multiplicative EXPOSURE fields
  • GAMMA
  • Automatic application of exposure, gamma, primaries, or color-correction fields

Encode

  • Deterministic RGBE conversion from rgbf32 and normalized display pixels
  • Standard scanline RLE for legal scanline widths
  • Legacy flat output for widths outside the standard RLE range
  • Optional EXPOSURE and GAMMA fields

Validation

  • Header, dimension, allocation, scanline length, packet length, and truncation checks
  • Real 1K Poly Haven CC0 HDR benchmark inputs
  • Deterministic exponent-extreme and orientation tests