Nodes/ComfyUI-Leputen-Utils/Load Images (Batch)
ComfyUI Node

Load Images (Batch)

Load a whole folder of images — EXR included — in memory-safe batches

By lilquail·Created 9 months ago·Updated 9 months ago· 1
Load Images (Batch)
    • image
    • mask
    • filename
    • path
    directorypath/to/folder
    pattern*
    include_subfoldersfalse
    batch_index0
    batch_size-1
    alpha_bleedtrue
    blur_radius0.0
    invert_maskfalse
    exr_tone_mapfalse

    The built-in Load Image opens one file at a time, by hand. Load Images (Batch) is the node for when you have a folder full of textures and a pipeline that should chew through all of them - and its EXR support is the differentiator, because standard ComfyUI loaders don't touch EXR/HDR files at all.

    It's the batch loader in this pack's image branch, the sibling of Load DDS Images (Batch) but for regular formats: PNG, JPG, WebP, TIFF, TGA, and EXR. Point it at a directory, filter with a glob pattern, and out come image/mask/filename lists.

    How it works

    First run does a full directory scan with pattern filtering; the pack caches the scan so repeat runs on the same folder are instant (auto-invalidated when contents change). Then files are loaded in batches defined by two inputs:

    • batch_size - -1 (default) loads everything at once. A positive value loads that many files per pass so you can process thousands of images without blowing up RAM.
    • batch_index - which batch you're on; connect an external iterator to step automatically, or nudge it manually.

    pattern is glob syntax: *_a.png grabs only albedo files, *_a.png;*_n.png grabs albedo and normal maps, ? matches a single character, and semicolons separate multiple patterns.

    The optional exr_tone_map matters for HDR work: for EXR files it applies Reinhard tone mapping so values land in display range; leave it off and raw HDR values are preserved (clamped to 0–1).

    Inputs and outputs

    Required: directory, pattern (* default), include_subfolders, batch_index, batch_size, alpha_bleed. Optional: blur_radius, invert_mask, exr_tone_map.

    Outputs (all lists): image, mask, filename, path.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/lilquail/ComfyUI-Leputen-Utils
    

    Restart ComfyUI, find it under Leputen-Utils → Image. Unlike the DDS branch, this one has no Windows-only dependency - EXR loading included.

    Troubleshooting

    • Patterns are case-sensitive on Linux/macOS but case-insensitive on Windows - a *.PNG filter behaves differently across platforms; keep patterns lowercase.
    • HDR images look blown out - that's exr_tone_map off (raw values). Turn it on if you just want to look at them; leave it off if you're processing HDR values in-engine.
    • Slow first scan - expected; the README quotes ~2s for 13,000 files, then instant cache hits.
    • Memory with huge folders - batch_size=-1 loads all files at once. For a library of 2K textures, use a real batch size and an iterator instead of trusting the default.

    If your job is "normalize every texture in this project folder," this is the node that makes it a workflow instead of an afternoon of clicking. And if those textures are HDR, it's the only sane loader in the pack for it.

    CategoryLeputen-Utils/Image

    Inputs (9)

    NameTypeDefaultDescription
    directorySTRINGpath/to/folderThe absolute path to the directory containing files to load.
    patternSTRING*Filename filter pattern using glob syntax. Examples: • * = all files • *_a.dds = files ending in _a.dds • texture_* = files starting with texture_ Multiple patterns: Use semicolon (;) to match multiple patterns: • *_a.dds;*_n.dds = albedo and normal maps
    include_subfoldersBOOLEANfalseIf enabled, recursively scans subdirectories for matching files.
    batch_indexINT0Current batch index. Connect an external iterator for automatic incrementing.
    batch_sizeINT-1Number of files to load per batch. Set to -1 to load ALL files at once.
    alpha_bleedBOOLEANtrueEnable alpha bleeding to prevent halo artifacts around transparent areas.
    blur_radiusoptFLOAT0.00–10Apply blur during alpha bleeding for smoother transitions.
    invert_maskoptBOOLEANfalseInvert the output mask (white becomes black and vice-versa).
    exr_tone_mapoptBOOLEANfalseFor EXR files: Apply Reinhard tone mapping. If disabled, raw HDR values are preserved.

    Outputs (4)

    NameTypeDescription
    imageIMAGE
    maskMASK
    filenameSTRING
    pathSTRING