Nodes/ComfyUI-northTools/Load Image List from Directory
ComfyUI Node

Load Image List from Directory

Point it at a folder, get a whole image list back — and the metadata to go with it

By northumber·Created about a year ago·Updated about a year ago· 4
Load Image List from Directory
    • IMAGE
    • MASK
    • FILE PATH
    • METADATA
    • INDEX COUNT
    directory
    image_load_cap0
    start_index0
    load_alwaysfalse

    This is the flagship node of the pack, and the only one with any real-world footprint to show for it. Give it a folder path and it dumps every image in that folder out as a list - but unlike the plain "Load Image" node in core ComfyUI, it also hands you the file paths, the embedded metadata, and each image's position in the folder. That extra plumbing is the whole point: it's built for batch workflows where you want to process a folder of images without dragging each one in by hand.

    Load Images From Dir List in ComfyUI-Inspire Pack is the original here; the author forked it, trimmed it, and added the METADATA and INDEX COUNT outputs that Inspire's version doesn't expose. If you already run Inspire Pack you get this node's real value from those two extra wires rather than the loading itself.

    How it works

    On every execution it lists the directory, keeps files ending in .jpg, .jpeg, .png or .webp, sorts them alphabetically, and opens each with PIL - applying EXIF orientation so phone photos don't come in sideways. Each image becomes a float32 tensor scaled to 0–1, and the outputs are marked OUTPUT_IS_LIST, so you get one slot per image instead of one giant batch.

    That last bit is the part that surprises people: the IMAGE output is a list, not a tensor batch, so images of different sizes can coexist. The companion LoadImagesFromDirByIndexBatch node stacks them into one tensor - and then they must share dimensions.

    Inputs that matter

    Only three are worth touching beyond the defaults:

    • directory (required) - an absolute path to the folder. The node raises FileNotFoundError if it isn't a real directory or contains no image files, so you can't point it at an empty folder and get away with it.
    • image_load_cap - max images to load; 0 (the default) means load everything. Set it to grab the first N for a quick test run.
    • start_index - skip the first N alphabetically-sorted files. Combined with image_load_cap it gives you crude pagination.

    There's also load_always, which forces the node to re-run every execution instead of caching its result - tick it when the folder contents change between runs.

    The five outputs are IMAGE, MASK, FILE PATH, METADATA, and INDEX COUNT, all as lists. The METADATA string is a Python-dict-as-string (PNG text chunks plus EXIF); the pack's own ExtractMetadataByKey node is the natural way to pull one value out of it. INDEX COUNT lines up with the load-by-index nodes in this same pack, and FILE PATH feeds save nodes so you know which input produced which output.

    Install

    ComfyUI Manager → search "ComfyUI-northTools" → install, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/northumber/ComfyUI-northTools
    

    Then restart ComfyUI. There are no model downloads and no real dependencies - requirements.txt lists only pillow, numpy, torch, which ComfyUI already ships with.

    Where people get burned

    • Alphabetical sort is a trap for numbered files. 10.png sorts before 2.png. Zero-pad your filenames (01.png, 02.png) or the order will quietly not be what you expect.
    • It needs an absolute path. Unlike core Load Image, there's no input/ shorthand - paste the full path or feed it from a text node.
    • METADATA is not JSON. It's the stringified Python dict, so a plain JSON-parsing node will choke on the single quotes. Use ExtractMetadataByKey or be ready to clean it up.
    • Masks only appear for RGBA images. A no-alpha PNG gets a zero tensor instead, which is fine for masking purposes but can confuse you if you expected an actual mask.

    For a small pack that mostly automates the author's own pipeline, this node is the one that earns its keep.

    CategorynorthTools

    Inputs (4)

    NameTypeDefaultDescription
    directorySTRING
    image_load_capoptINT0
    start_indexoptINT0
    load_alwaysoptBOOLEANfalse

    Outputs (5)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK
    FILE PATHSTRING
    METADATASTRING
    INDEX COUNTINT