Nodes/ComfyUI-UtilsCollection/Load Images (Directory) (Legacy)
ComfyUI Node

Load Images (Directory) (Legacy)

Load a whole folder of images as a batch

By silveroxides·Created 2 months ago·Updated about 7 hours ago· 24
Load Images (Directory) (Legacy)
    • IMAGE
    • MASK
    • MASK_INVERTED
    directory_path
    start_index0
    load_count1

    The single-image loader gets you one file; this one gets you a folder. Point it at a directory of frames - exported video frames, a contact sheet source, a batch of LoRA training crops - and it hands you a batch of IMAGEs plus per-image masks. No dragging files into the input folder, no "Load Images" workarounds, no python script node. Just a path and a count.

    How it works

    Give it a directory_path (same tolerant path handling as the pack's single-image loader - any OS separators, relative or absolute). It lists everything in the folder, keeps only the common image extensions (png, jpg, jpeg, webp, bmp, tiff, gif, mpo), sorts the list, then slices out the range you asked for.

    The two range inputs are the whole game:

    • start_index (default 0) - which image in the sorted list to begin at.
    • load_count (default 1, up to 1024) - how many to pull in.

    Each file is loaded first-frame-only, EXIF-rotated, and its alpha channel becomes a mask exactly like the single-path loader (transparent = white, plus an MASK_INVERTED output flipped the other way). All three outputs - IMAGE, MASK, MASK_INVERTED - come out as lists, so wire them into nodes that accept a list of images, or use a list→batch converter if your downstream expects a single tensor batch. The loader also hashes the directory contents for change detection, so it re-reads when files are added or replaced.

    When it earns its keep

    Batch stylization or upscaling of a frame sequence is the obvious one: export 240 frames, load them in chunks, run them through the same edit, and the whole folder walks through without manual file juggling. It's also handy for feeding a directory of reference images into a multi-reference editor, or driving an image-batch pipeline where start_index/load_count let you process a big folder in slices without loading everything at once.

    The traps

    • The sort is plain alphabetical, not natural. frame10.png sorts before frame2.png, because string sort doesn't know about numbers. If your files are numbered with varying digit counts, rename to zero-padded (frame_001, frame_002, …) before pointing this at them, or you'll load frames out of order and not notice until the video looks wrong.
    • Dimension mismatches get silently skipped (a console warning only). If the folder mixes resolutions, your "batch of 100" may quietly become 97.
    • It's first-frame-only per file, and files that fail to open are skipped with a warning.
    • Load count maxes at 1024 per run - big folders are chunked, not one-shot.

    Installing it

    Ships in silveroxides/ComfyUI-UtilsCollection. ComfyUI Manager: search ComfyUI-UtilsCollection, install, restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/silveroxides/ComfyUI-UtilsCollection
    cd ComfyUI-UtilsCollection
    pip install -r requirements.txt   # opencv-python, typing-extensions
    

    Restart and it's registered. No model downloads; OpenCV is the only real dependency. This is the legacy alias of canonical UC_LoadImageDirectory - same behavior, "(Legacy)" just keeps old workflows resolving.

    Categoryadvanced/image

    Inputs (3)

    NameTypeDefaultDescription
    directory_pathSTRINGPath to the directory containing images.
    start_indexINT0Index of the first image to load (sorted alphabetically).
    load_countINT11–1024Number of images to load.

    Outputs (3)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK
    MASK_INVERTEDMASK