Save AVIF/HEIC HDR (Native)
The node that turns your film grade into a file a phone calls HDR
- hdr_image
Almost every ComfyUI output node hands you an 8-bit PNG. This one is the exception: it writes a file that an HDR phone, tablet, or monitor actually recognizes as HDR - a 10-bit AVIF or HEIC encoded in PQ (SMPTE ST 2084) with Rec.2020 primaries, plus maxCLL/maxFALL metadata so a player knows how bright it is. It's the payoff node of the Comfy-FilmSimulator pack. Everything upstream - DNG reader, film sim, gainmap merge - is basically setup for the moment this node writes a file. The result won't look special in a chat app or browser (they flatten it to SDR), but open it on HDR hardware and highlights that were clipped on every screen you've got come back to life.
How it works. The node expects a linear, scene-referred image where a pixel value of 1.0 corresponds to ref_white_nits of luminance. It multiplies each channel into the Rec.2020 color space with a fixed matrix, scales by ref_white_nits to get absolute luminance in nits, then maps that through the PQ (Perceptual Quantizer, ST 2084) transfer curve - the same EOTF HDR10 content uses. The result is written as 10-bit data via pillow-heif with the color primaries, transfer, and matrix tags an HDR decoder actually respects, and maxCLL/maxFALL are computed straight from the frame.
The inputs that matter. There are only five, and two of them decide whether the file looks right:
ref_white_nits(default 203, range 80–1000) - this is the "1.0 in the tensor = how many nits" map. 203 is a sane reference white for a film pipeline. Get it wrong and the whole file is over- or under-exposed in PQ. The source even prints a warning when your input's max value is above 1.5, because that usually means you fed it an image already in absolute nits.hdr_image- wire this tohdr_imageout of FilmSimNode, ormerged_hdrout of HDR Merge (Gainmap). Feeding it an ordinary sRGB 8-bit image gives you a dim, weird file. This node does not forgive.format(AVIF default, or HEIC),quality(default 90),filename_prefix- the boring ones. Files land in ComfyUI's output folder with a numeric suffix.
One honest caveat. Despite sitting next to a "gainmap" node, this writes a straight PQ/Rec.2020 HDR file, not an Ultra HDR gainmap container like a Pixel's JPEG. The gainmap upstream is a computation tool; what gets embedded here is maxCLL/maxFALL metadata. If you wanted the Android-style "one file that's both SDR and HDR" thing, that's a bigger project than this pack.
Install. Same as the rest of the pack: ComfyUI Manager → search "Comfy-FilmSimulator" → install, or cd ComfyUI/custom_nodes && git clone https://github.com/zhuyanan/Comfy-FilmSimulator, then restart. No model files to download - it's pure image math. The one dependency that actually matters here is pillow-heif; without it the node prints "pillow_heif not available" and saves nothing. If Manager's pip step didn't grab it, pip install pillow-heif fixes it.
Where people get burned. The silent-save-nothing failure above, and feeding it a non-linear image. If your output looks washed out or gray, check is_linear_input upstream and make sure you're feeding the film node's linear hdr_image, not its tonemapped preview_sdr.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| hdr_image | IMAGE | — | |
| filename_prefix | STRING | HDR_Image | — |
| format | COMBO | AVIF | 2 options: AVIF, HEIC |
| quality | INT | 90 | — |
| ref_white_nits | FLOAT | 203.0080–1000 | — |
Outputs (0)
No outputs