Nodes/ComfyUI-Light-Tool/Light-Tool: Load Image List
ComfyUI Node

Light-Tool: Load Image List

Load a whole folder of images in one go, with slicing

By ihmily·Created 2 years ago·Updated 4 months ago· 20
Light-Tool: Load Image List
    • IMAGE
    • MASK
    • FILE PATH
    directoryplease input your image dir path
    image_load_num0
    start_index0
    load_alwaysfalse
    keep_alpha_channelfalse

    ComfyUI's built-in loader is strictly one-file-at-a-time, which makes batch processing a folder of images awkward. Light-Tool: LoadImagesFromDir loads an entire directory into your graph: point it at a path, get a list of images, their masks, and their file paths. This is the node you build a batch pipeline on.

    Inputs: directory (a filesystem path - required), and four optional knobs: image_load_num (how many images to load, 0 = everything), start_index (where to begin), load_always (re-read the folder on every run), and keep_alpha_channel (same transparency handling as the rest of the pack). Outputs are all lists: IMAGE, MASK, and FILE PATH.

    How it works. It scans the directory, filters to .jpg, .jpeg, .png, .webp, sorts them by filename, then slices from start_index for image_load_num entries (or to the end if image_load_num is 0). Each file becomes an image tensor, an alpha-derived mask (1 - alpha, or a black placeholder if there's no alpha), and a string path. The outputs are Python lists rather than a concatenated batch - which is deliberate and worth understanding: it means the images can be different sizes without a crash, and the FILE PATH list lets you know which file you're looking at.

    The two gotchas that bite.

    • Mixed sizes. Because it's a list output, differently-sized images survive the load. But the moment you feed that list into a batch node that expects a uniform tensor - most KSampler-adjacent and compositing nodes - it'll complain. This loader hands you a bag of images; sizing them consistently is your job downstream.
    • Caching. ComfyUI caches node outputs so unchanged inputs don't re-run. If the folder contents change between runs - you're dropping new frames in as you go - the graph may reuse the stale list. That's exactly what load_always exists for: it forces a re-read on every execution. Turn it on when your folder is alive; leave it off for static sets.

    When you'd reach for it. Frame sequences for video work, batches of references you want to run through the same chain, or any "process everything in this folder" workflow. It's the kind of node that turns a manual one-by-one slog into a single queue run.

    Installing. Same as the whole pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ihmily/ComfyUI-Light-Tool.git
    pip install -r requirements.txt
    # restart ComfyUI
    

    Or ComfyUI Manager → search ComfyUI-Light-Tool → Install. No models. The path is a plain absolute filesystem path, not the ComfyUI input folder - the node reads whatever directory you give it, which is what makes it more flexible than the built-in picker.

    Verdict: genuinely useful for batch work, with the one caveat that "list of anything-sized images" punts the consistency problem to you. If all your files are the same dimensions - which is the normal case for frame sequences - it just works.

    CategoryComfyUI-Light-Tool/image/LoadImage

    Inputs (5)

    NameTypeDefaultDescription
    directorySTRINGplease input your image dir path
    image_load_numoptINT0
    start_indexoptINT0
    load_alwaysoptBOOLEANfalse
    keep_alpha_channeloptBOOLEANfalse

    Outputs (3)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK
    FILE PATHSTRING