Nodes/Eden.art nodesuite/LoadImagesByFilename
ComfyUI Node Runs on cloud

LoadImagesByFilename

Feed a Shuffled Batch From a Filename List

By edenartlabΒ·Created 3 years agoΒ·Updated 6 months agoΒ· 119
LoadImagesByFilename
    • IMAGE
    β—„filenameβ–Ί
    β—„max_num_imagesβ€”β–Ί
    β—„seed0β–Ί
    β—„sortfalseβ–Ί
    β—„loop_sequencefalseβ–Ί

    Most image loaders in ComfyUI hand you one image you pick by hand. LoadImagesByFilename is for when you've already got a list of filenames - from a folder scan, a wildcard, another node's output - and you want a controlled, repeatable batch out of it. Think: shuffle a reference set by seed, grab the first N, sort them if order matters, and feed the whole batch to an IP-Adapter or a batch sampler.

    The input that's different here is filename, a COMBO (a list) rather than a folder or a file picker. You wire in a list of paths, and the node takes over from there. The rest of the controls are the interesting part:

    • seed - shuffle seed. Same list + same seed = same order, which is what makes this usable in reproducible batch workflows. It shuffles before truncation, so the seed controls which images you get, not just their order.
    • max_num_images - how many to take after the shuffle. 0 means "take everything."
    • sort - if you'd rather have a deterministic sorted order than a shuffle, turn this on (it sorts after the shuffle).
    • loop_sequence - appends the first image to the end of the batch, a handy trick when you're building a looping animation.

    The output is a single IMAGE batch, already converted to float RGB and EXIF-transposed, with 16-bit-per-channel "mode I" images normalized down. It does NOT give you the filenames back - if you need paths downstream, that's LoadRandomImage's job.

    How it behaves

    The mechanism is refreshingly unsubtle: seed the RNG, shuffle the list, slice it, optionally sort, then PIL.Image.open each one. The two things that actually bite people: it expects full paths, not bare filenames in the current directory, and it does no cropping or resizing - a batch of mixed-aspect images comes out mixed-aspect, which will trip up anything downstream that wants a uniform tensor. Pre-size your images if uniformity matters.

    Installing it

    Ships in the Eden.art nodesuite (edenartlab/eden_comfy_pipelines). ComfyUI Manager - search "Eden" - or:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/edenartlab/eden_comfy_pipelines.git
    cd eden_comfy_pipelines
    pip install -r requirements.txt
    

    Restart, find it under Eden 🌱. The pack installs a shared set of dependencies (scikit-learn, transformers, opencv-python, clip-interrogator among them) into your global environment, which is the usual ecosystem trade-off: one install, but more surface for dependency conflicts.

    Common issues

    The classic failure is a mismatch between what you feed in and what's on disk - a deleted file dies with a plain FileNotFoundError mid-batch, no graceful skip. And remember the seed shuffles first: if you set max_num_images to 4 and expect "first 4 alphabetically," you need sort on, because seed-sorting gives you a shuffled 4. That one's caught more than a few people.

    CategoryEden 🌱

    Inputs (5)

    NameTypeDefaultDescription
    filenameCOMBOβ€”
    max_num_imagesINT0–9223372036854776000β€”
    seedINT00–100000β€”
    sortBOOLEANfalseβ€”
    loop_sequenceBOOLEANfalseβ€”

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGEβ€”