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

Load Images (Directory)

Load a whole folder of images for batch workflows

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

    ComfyUI's built-in Load Image makes you pick files one at a time from the input folder. When you want to process all the frames of an animation, every PNG in a dataset folder, or a batch of reference shots, that's grindingly slow. UC_LoadImageDirectory is the bulk alternative: point it at any directory on the machine running ComfyUI, and it loads a slice of that folder as a list of images, ready to feed a batch workflow.

    It's the directory sibling of UC_LoadImagePath (single file, explicit path) - both exist because Core's loader is confined to ComfyUI's input directory, and batch work rarely lives there.

    The three inputs

    • directory_path - absolute or relative path to a folder of images. Backslashes and forward slashes both work; the node normalizes them.
    • start_index (0) - index of the first image to load, in alphabetical sort order. Skip the first N files without deleting them.
    • load_count (1, max 1024) - how many images to load from that starting point. This is how you page through a big folder: start_index=0, load_count=50, then start_index=50, load_count=50, and so on.

    Outputs are the useful trio, each as a list:

    • IMAGE - the loaded images.
    • MASK - a mask per image, taken from the alpha channel (full-size, not the tiny default masks Core sometimes gives you).
    • MASK_INVERTED - the inverted masks, for compositing and inpainting setups that want "everything but the subject" as their mask.

    How it works

    It lists the directory, sorts alphabetically (so your frame_001.png ... frame_100.png ordering holds as long as your filenames zero-pad correctly - the classic frame_10.png before frame_2.png trap applies), and loads the requested slice. Because it emits lists rather than one batch, it pairs naturally with this pack's UC_ListToImageBatch when you need a stacked batch downstream.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/silveroxides/ComfyUI-UtilsCollection
    

    Restart (or ComfyUI Manager → search "ComfyUI-UtilsCollection"). The pack's only deps are opencv-python and typing-extensions.

    Two gotchas. First, the path is read by the server process - if ComfyUI runs on a remote box, the path must exist there, not on your laptop. Second, mixed resolutions in one folder will load fine but can trip up anything downstream that expects uniform shapes; UC_ListToImageBatch will silently take its slow resize path on those. Keep folders uniform, or resize after loading. For anything batch-y - frame sequences, dataset sweeps, bulk reference loading - this node removes the single biggest annoyance of stock ComfyUI image loading.

    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