ComfyUI Node

Load EXR

Loading 32-bit EXR into ComfyUI

By spacepxl·Created 3 years ago·Updated 6 months ago· 102
Load EXR
    • RGB
    • alpha
    • batch_size
    filepathpath to directory or .exr file
    tonemapsRGB
    image_load_cap0
    skip_first_images0
    select_every_nth1

    If you've ever rendered a depth map or a displacement map and watched PNG crush it to 256 levels per channel, you know why EXR exists. EXR is the floating-point image format the VFX world lives in: each channel is a full 32-bit float, so gradients stay smooth, HDR values survive, and negatives are fine. This node is the read half of that story - it pulls a .exr back into the graph as a normal IMAGE, ready for anything downstream.

    This is the pack's flagship, and it's earned the reputation. When someone on r/comfyui asked how to export EXR from ComfyUI, the top answer was just the link to spacepxl's repo. It's the community default for "get real precision in and out of ComfyUI."

    How it works

    Under the hood it's OpenCV reading with IMREAD_UNCHANGED - which hands back the raw float32 channel data - with the BGR→RGB flip done for you. The interesting knob is tonemap, a three-way enum:

    • linear - raw values, untouched. Feed this into pipelines that expect scene-linear data.
    • sRGB - encodes the linear values to sRGB so the image looks right on a normal monitor.
    • Reinhard - clamps and compresses HDR values first (tone maps the range), then encodes. For looking at something with a big dynamic range.

    Tonemapping is a display decision, not a data decision. If you're loading an EXR to process it, linear keeps the math honest. If you're loading it to eyeball it, sRGB stops it looking washed out.

    Inputs and outputs

    The inputs that matter: filepath (a single .exr, or a folder - it'll load every .exr in it, sorted), and tonemap. The three optional ints are the VHS-style batch controls: image_load_cap (0 = load everything), skip_first_images, and select_every_nth for subsampling a sequence.

    Outputs are RGB (IMAGE), alpha (MASK, pulled from the fourth channel and clipped to 0–1), and batch_size (INT). Wire RGB into anything that takes an image - KSampler for img2img, upscalers, VAE encodes.

    Install

    Part of spacepxl's ComfyUI-HQ-Image-Save pack. ComfyUI Manager: search ComfyUI-HQ-Image-Save, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/spacepxl/ComfyUI-HQ-Image-Save
    

    Dependencies are imageio and opencv-python - no models, no keys. One caveat: OpenCV's EXR support is compiled in as a codec and has to be enabled. The pack sets OPENCV_IO_ENABLE_OPENEXR=1 on import, so with the standard opencv-python wheel you're fine. If you get an error that the OpenEXR codec is disabled, your OpenCV build was compiled without it - the repo's issue #8 covers it, and the fix is basically making sure the regular opencv-python (not a stripped or headless-minimal build) is what's installed.

    Pair it with

    SaveEXR from the same pack for the round trip. And if you're generating at high precision, the author recommends running ComfyUI with --fp32-vae so the VAE decode doesn't round-trip through fp16 and quietly drop the very precision you're saving the EXR to preserve.

    CategoryHQ-Image-Save

    Inputs (5)

    NameTypeDefaultDescription
    filepathSTRINGpath to directory or .exr file
    tonemapCOMBOsRGB3 options: linear, sRGB, Reinhard
    image_load_capoptINT0
    skip_first_imagesoptINT0
    select_every_nthoptINT1

    Outputs (3)

    NameTypeDescription
    RGBIMAGE
    alphaMASK
    batch_sizeINT