Exporting HLG Photos to AVIF: HDR Workflow Guide
Exporting photographs using Hybrid Log-Gamma (HLG) into the AVIF format allows photographers to preserve true high dynamic range (HDR) luminance and wide color gamuts for compatible displays while maintaining backward compatibility. This guide outlines the complete technical workflow for preparing, color managing, and encoding HLG still images into the AVIF container, detailing every step from raw development to metadata tagging.
1. Source Preparation and Raw Development
To achieve a true HLG photograph, the image must either be captured natively as an HLG file (available in select mirrorless cameras) or developed from a standard camera RAW file.
- Working Color Space: Set your digital photo processor (such as Adobe Lightroom, Camera Raw, or darktable) to a wide color gamut capable of containing HDR colors, specifically Rec. 2020.
- HDR Editing Mode: Enable the HDR editing pipeline in your software. This expands the histogram past standard dynamic range (100% / SDR white) to accommodate specular highlights up to 1,000 nits or higher.
- Tonal Allocation: Balance your exposure so that diffuse white (paper or standard bright surfaces) sits around standard SDR limits (203 nits in HDR grading standards), reserving the higher stops of luminance strictly for highlights, reflections, and light sources.
2. Setting the Transfer Function
Hybrid Log-Gamma relies on the ARIB STD-B67 standard (defined in ITU-R BT.2100). The image data must be mapped to this specific electro-optical transfer function (EOTF):
- Gamma vs. Log: HLG uses a standard gamma curve for lower luminance values and a logarithmic curve for higher luminance values. Ensure that your output tone response curve is set explicitly to BT.2100 HLG rather than PQ (Perceptual Quantizer / SMPTE ST 2084), as PQ requires absolute luminance targeting, whereas HLG is scene-referred and scales to display capabilities.
3. Bit Depth and Chroma Subsampling
Encoding HLG into AVIF demands precise parameters to prevent color banding and compression artifacts in highlight transitions:
- Bit Depth: Choose 10-bit color. While 8-bit AVIF exists, it lacks the precision required for log-based curves and will cause noticeable posterization. 12-bit can be used if supported by your encoder, but 10-bit provides universal hardware compatibility.
- Pixel Format: Select
YUV420for standard distribution and smaller file sizes, orYUV444(or full RGB) if high-frequency color detail must be preserved without chroma subsampling.
4. Encoding to AVIF with NCLX Color Metadata
The AVIF container (based on the AV1 video codec) requires proper Color Information Box (NCLX) tags so that operating systems and web browsers correctly interpret the dynamic range.
If using a command-line tool like ffmpeg or
cavif, apply the following ITU-R BT.2100 color
parameters:
- Color Primaries:
9(BT.2020) - Transfer Characteristics:
18(ARIB STD-B67 / HLG) - Matrix Coefficients:
9(BT.2020 non-constant luminance) or0(Identity / RGB, depending on whether conversion to YUV occurred) - Color Range: Full (
pcorfull)
If exporting from a GUI application such as Adobe Lightroom or Photoshop:
- Select AVIF as the file format in the Export dialog.
- Check the HDR Output option.
- Select Rec. 2020 HLG as the export color space.
5. Verification and Validation
Before publishing, verify that the image renders correctly across platforms:
- Header Inspection: Use tools like
exiftoolormp4boxto confirm that the NCLX property containsprimaries: 9,transfer: 18, andmatrix: 9. - Display Testing: Open the exported AVIF file in modern web browsers (such as Chrome or Safari) on an HDR-capable monitor. On a correctly configured system, the base image will display at standard brightness while specular highlights exceed normal display white without clipping.