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

ImageFolderIterator

Walk a folder of images one at a time, in order β€” the batch pipeline workhorse

By edenartlabΒ·Created 3 years agoΒ·Updated 6 months agoΒ· 119
ImageFolderIterator
    • image
    • filename
    β—„folder.β–Ί
    β—„index0β–Ί
    β—„sorttrueβ–Ί

    ImageFolderIterator is the "next image, please" node. You point it at a folder, give it an index, and it loads the image at that position - then hands you both the image and its filename. Change the index and you get the next one. It's the backbone of batch workflows where you want to process a folder of images one at a time: same graph, different input, run after run.

    It's part of eden_comfy_pipelines, Eden.art's 70+ node suite.

    What you set

    • folder - the directory to iterate, default .. Images are picked directly from the folder; no subfolders, no recursion.
    • index - which image to load, starting at 0. This is the value you drive from a counter, a loop, or a manual widget.
    • sort - true by default, which sorts filenames alphabetically before indexing. Sorting matters because "index 0" is meaningless without a stable order. If you turn it off, you get whatever order the filesystem returns - almost never what you want.

    Two outputs:

    • image (IMAGE) - the loaded image, RGB, normalized, with the batch dimension ready for downstream nodes.
    • filename (STRING) - the file's base name without the extension. Handy for building output filenames that match the input: process photo_007.png and save as photo_007_processed.png.

    How it behaves

    Two behaviors are worth knowing before they surprise you. First, it wraps around: the index is taken modulo the image count, so index 9999 on a 4-image folder loads image 3. That's deliberate and actually useful for looping workflows - you never get an out-of-range error, you just loop. Second, it validates images before listing them: it checks file extensions (png, jpg, jpeg, bmp, webp) and verifies each file is a real image, skipping anything corrupt. A folder with a stray .txt or a truncated file won't break the run - it just won't be counted.

    It also handles EXIF rotation and 16-bit mode 'I' images, which means phone photos and scans load with the correct orientation. That's the kind of polish that keeps batch runs from silently producing sideways results.

    Where it fits

    • Batch processing: drive index from a counter node (or the pack's logic nodes) and run the graph N times to process N images with the exact same pipeline.
    • Frame sequences: iterate a folder of rendered frames, feeding each into img2img or a video node in order.
    • Filename-synced outputs: because you get the filename alongside, your outputs can always trace back to their source.

    The main limitation is the manual index: this node doesn't auto-advance on its own, so "iterate the whole folder" means wiring an incrementing index somewhere. The pack's workflow examples do exactly that - a counter feeding the iterator in a loop. If you want truly hands-off batch, pair this with a loop or queue node.

    Installing it

    Standard pack install - 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 ComfyUI. It uses Pillow and numpy, both standard - no model downloads, no keys, CPU-only. For "process this folder, one image at a time, with a stable order," it's hard to beat.

    CategoryEden 🌱

    Inputs (3)

    NameTypeDefaultDescription
    folderSTRING.β€”
    indexINT00–99999β€”
    sortBOOLEANtrueβ€”

    Outputs (2)

    NameTypeDescription
    imageIMAGEβ€”
    filenameSTRINGβ€”