Nodes/comfyui-x2hdr/X2HDR Save EXR
ComfyUI Node

X2HDR Save EXR

Save actual linear HDR files — this is how you get an EXR out of ComfyUI

By facok·Created 2 months ago·Updated about a month ago· 3
X2HDR Save EXR
  • hdr_image
  • hdr_image
  • exr_paths
filename_prefixx2hdr
sanitize_nonfinitetrue
clamp_negativetrue

ComfyUI's Save Image writes PNGs and JPGs. PNGs are gamma-encoded and useless as HDR masters - hand one to a compositor and it's like showing a photograph to a light meter, because a gamma-encoded image treated as linear light poisons every blend in a color-managed comp. To get real HDR you need a float file, and the float file is OpenEXR. X2HDR Save EXR writes linear float HDR RGB as .exr files into ComfyUI's output directory - no gamma, no tone mapping, raw scene-linear data. Exactly what an HDR pipeline expects.

How it works

It encodes via PyAV's EXR encoder - the av package, float32 GBR pixel format - and if PyAV can't write EXR in your environment, it falls back to OpenCV (which is why the pack lists opencv-python as an optional dependency). Because you don't want garbage in a file meant for production, it sanitizes first.

Inputs

  • hdr_image - your linear HDR tensor, from any X2HDR decode or even graded_linear from X2HDR Color Grade.
  • filename_prefix - x2hdr by default; files land in ComfyUI/output with a counter, e.g. x2hdr_00001_.exr.
  • sanitize_nonfinite (default true) - replaces NaN/Inf with 0 so a broken decode can't write a corrupt file.
  • clamp_negative (default true) - clamps negative linear values to 0. LogC decodes can legitimately produce negatives below reference black, so this is usually what you want; turn it off only if you truly need to preserve them.

Outputs

  • hdr_image - the sanitized tensor that was written, so you can chain it into downstream HDR nodes without re-reading the EXR. Handy.
  • exr_paths (STRING) - the absolute paths written, one per line. Wire it to a text-display node to confirm where your files went.

This is an output node, so it always runs - put it where you actually want files on disk.

Installing it

Part of facok/comfyui-x2hdr. ComfyUI Manager → search comfyui-x2hdr → install, restart, nodes under image/HDR/X2HDR. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/facok/comfyui-x2hdr

then restart. This node is why av is a hard requirement: the pack imports it at load time, so a missing PyAV breaks the whole pack, not just EXR saving. If you see an import error after installing, run pip install av in ComfyUI's Python environment.

Where people get burned

  • EXR files are big. Float32, three channels, uncompressed-ish. That's the price of a real HDR master; it's not a bug.
  • Don't confuse the PNG with the EXR. If you also save the LDR graded_display from X2HDR Color Grade, remember which is which: the PNG is for looking, the EXR is for working.
  • If EXR writes silently fail, check that PyAV's EXR codec exists in your install - that's the exact scenario the OpenCV fallback exists for.
Categoryimage/HDR/X2HDR

Inputs (4)

NameTypeDefaultDescription
hdr_imageIMAGE
filename_prefixSTRINGx2hdr
sanitize_nonfiniteBOOLEANtrue
clamp_negativeBOOLEANtrue

Outputs (2)

NameTypeDescription
hdr_imageIMAGE
exr_pathsSTRING