Nodes/ComfyUI-batching-nodes/Batch Images (Folder Loader)
ComfyUI Node

Batch Images (Folder Loader)

Point it at a folder, get every image run through your workflow

By Hahihula·Created 8 months ago·Updated 5 months ago· 14
Batch Images (Folder Loader)
    • images
    • filenames
    • count
    folder_path/tmp/ComfyUI/input
    image_extensionspng,jpg,jpeg,webp,bmp,gif
    sort_byname
    start_index0
    max_images0

    ComfyUI's built-in Load Image is fine until you've got fifty images that all need the same treatment - an upscale pass, a face fix, a style transfer, a dataset prep run. Doing that one file at a time is exactly the manual copy-paste grind this pack exists to kill. Batch Images (Folder Loader) is Load Image's "load all of them" cousin: point it at a folder, and every matching image flows through your workflow on a single queue press.

    How it works

    The node scans the folder, filters files by extension, sorts them, and loads each one as a separate tensor. Because the images output is a list, ComfyUI's own machinery then runs your downstream graph once per image - same fan-out behavior as the pack's prompt loop, just with pixels. Each image is converted through PIL to RGB and normalized to the same float32 tensor format ComfyUI's standard Load Image produces, so anything you can connect to a regular image input will accept these.

    A detail worth knowing: if one file in the folder is corrupt or unreadable, it's logged and skipped rather than killing the whole batch. Your count may be smaller than the number of files in the folder, which is the "how do I know" answer for that discrepancy.

    The inputs that matter

    • folder_path - a plain string, defaulting to ComfyUI's own input directory. There's no file-browser dropdown like Load Image has, so it needs to be a path the server process can actually see (an absolute path is the safe move).
    • image_extensions - comma-separated, default png,jpg,jpeg,webp,bmp,gif. Matching is case-insensitive and tolerant of a leading dot, so PNG or .png both work.
    • sort_by - name, modified, or created. Ordering matters more than people think (see below).
    • start_index (optional) - skip the first N images. This is your resume-after-interrupt lever.
    • max_images (optional) - load at most N; 0 means all. This is your memory lever.

    Outputs

    • images - the list of image tensors. Wire this into whatever processes each image (VAE Encode, ControlNet preprocessor, upscale model).
    • filenames - the original file names, positionally matching images. Feed these into Save Image filename logic and you keep your names instead of getting ComfyUI_00001_. This is a genuinely nice touch.
    • count - integer, how many loaded.

    Installing it

    Same tiny MIT pack, ComfyUI-batching-nodes by Hahihula. Via ComfyUI Manager, search "ComfyUI Batching Nodes" (or "Batch Images") and install, then restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Hahihula/ComfyUI-batching-nodes
    

    Restart and watch the console for a Batch Image Loader Node - Loading... banner. No pip installs, no models, no keys - it only uses PIL/numpy/torch, all of which ComfyUI already ships.

    Where people get burned

    Memory is the real trap. Every image is loaded into RAM as a tensor up front, and a folder of a few hundred 2K photos will quietly eat gigabytes. The README's own advice is the right reflex: test with max_images: 10 first, then process in chunks by advancing start_index, or just keep folders small. It's a batch loader, not a streaming loader.

    Second trap is ordering. sort_by: name is a plain string sort, so 1.jpg, 2.jpg, 10.jpg comes out wrong - 10 sorts before 2. Rename with leading zeros (001.jpg) and the problem vanishes, exactly as the README warns.

    Finally, no subfolder recursion - it's a flat os.listdir, so throw everything you want processed into one directory.

    Categoryimage

    Inputs (5)

    NameTypeDefaultDescription
    folder_pathSTRING/tmp/ComfyUI/input
    image_extensionsSTRINGpng,jpg,jpeg,webp,bmp,gif
    sort_byCOMBOname3 options: name, modified, created
    start_indexoptINT00–10000
    max_imagesoptINT00–10000

    Outputs (3)

    NameTypeDescription
    imagesIMAGE
    filenamesSTRING
    countINT