Nodes/ComfyUI Simple Batch/πŸ“₯ Batch Load Image
ComfyUI Node

πŸ“₯ Batch Load Image

Folder of images, one workflow, zero babysitting

By lordekeenΒ·Created 24 days agoΒ·Updated 21 days agoΒ· 1
πŸ“₯ Batch Load Image
    • IMAGE
    • MASK
    • SLOT
    • TOTAL
    • RELATIVE_PATH
    β—„folder_pathβ€”β–Ί
    β—„recursivetrueβ–Ί
    β—„container_formatpngβ–Ί

    If you've ever sat there clicking Queue, waiting for one image to finish, then switching the file in LoadImage and clicking again - for three hundred images - this node is the thing you've been improvising around. BatchLoadImage reads every image in a folder tree and hands one to your workflow per run, and the matching BatchSaveImage keeps re-submitting the graph until the folder is empty. You queue once, go make tea, come back to a full output tree.

    It's a drop-in replacement for core LoadImage at the start of any workflow. The whole "batch" is an illusion that the Save node maintains - ComfyUI graphs are DAGs with no loops, so the batch works by the Save node resubmitting the same prompt until every file is handled. What the Load node actually does on each run is scan the folder tree, work out which file is next, and hand it over as a normal IMAGE.

    How it decides what's next

    Here's the clever bit, and it's what makes this pack feel different: the slot isn't a counter that lives in memory. The Load node rescans the folder on every single execution and derives which file is next from what already exists in the destination tree. Crash mid-batch, restart ComfyUI, add new files between runs - no reset step, no "resume from slot 47" checkbox. Whatever's already saved is skipped; whatever isn't is next. It reads the Save node's output_root and filename settings straight out of the shared graph, so the two halves can't disagree.

    The Load node also overrides its fingerprint (IS_CHANGED's V3 equivalent) to change every call, which forces a fresh scan each run instead of ComfyUI serving a stale cached item.

    The inputs and outputs that matter

    Three widgets, and you'll mostly touch two:

    • folder_path - absolute path to the root of your image tree. The one you set.
    • recursive - walks subfolders (default on).
    • container_format - png / jpg / jpeg / webp / bmp / tiff, or all_images. Default png. Gotcha: files with any other extension under folder_path are silently ignored - not logged, not counted. If your folder is half PNGs and half JPGs, you're running one batch per format.

    Outputs: IMAGE (float32 RGB tensor, values 0–1), MASK (derived from the alpha channel, so a PNG with transparency gives you a real mask; a zero mask if there's no alpha), plus SLOT (0-based index), TOTAL, and RELATIVE_PATH. Wire SLOT, TOTAL, and RELATIVE_PATH into the matching BatchSaveImage - that's how the save node names the file and mirrors your folder structure. Animated formats load every same-sized frame into the batch, which is a nice surprise if you feed it GIFs.

    One thing the pack does under the hood that you'll be glad about later: every node downstream of the Load produces a fresh cache entry per item, and in a big batch that's how RAM dies. The pack wraps ComfyUI's prompt executor and releases each item's cached intermediates before the next one runs, so only one item's worth is ever resident. The models upstream of the Load node stay loaded the whole batch - which is the point. No reloading between items.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/lordekeen/comfyui-simple-batch
    

    Restart ComfyUI. Or, if it's on the Registry, search ComfyUI Simple Batch in ComfyUI Manager and hit Install. No pip step - the pack uses only APIs ComfyUI already ships (PyAV for audio/video is bundled). It's written against the newer V3 node API, so you need a reasonably recent ComfyUI; a stale install simply won't see the nodes.

    Where people get burned

    The two classic ones: leaving output_root empty on the Save node - the batch stops dead with a clear error, which is the intended "please configure me" behavior - and putting output_root inside folder_path. The pack actively excludes the output root from scanning, so it won't loop, but a separate output folder is still cleaner. Keep output_root out of the tree you're reading, and this node quietly becomes one of the most useful things in your ComfyUI.

    Categoryimage/batch

    Inputs (3)

    NameTypeDefaultDescription
    folder_pathSTRINGRoot of the input folder tree (absolute path).
    recursiveBOOLEANtrueWalk subfolders recursively.
    container_formatCOMBOpngOnly files with this extension (or all_images) are processed.

    Outputs (5)

    NameTypeDescription
    IMAGEIMAGEThe current image as an IMAGE tensor [B, H, W, 3].
    MASKMASKThe alpha channel mask as a MASK tensor [B, H, W].
    SLOTINT0-based index of the current file for this run.
    TOTALINTTotal matching file count for this run.
    RELATIVE_PATHSTRINGCurrent file's path relative to folder_path (posix separators).