Nodes/ComfyAngel/Load Images Batch from Folder πŸͺ½
ComfyUI Node

Load Images Batch from Folder πŸͺ½

Every image in a folder, in one go

By ThepExcelΒ·Created 8 months agoΒ·Updated about a month agoΒ· 14
Load Images Batch from Folder πŸͺ½
    • images
    • filenames
    • count
    β—„folder_pathβ–Ί
    β—„sort_bynameβ–Ί
    β—„max_images0β–Ί
    β—„start_index0β–Ί
    β—„include_subdirsfalseβ–Ί
    β—„resize_modedisabledβ–Ί

    ComfyUI's built-in Load Image picks one file. Load Images Batch from Folder πŸͺ½ picks every file in a folder, hands you all of them at once, and is the natural fuel for the pack's loop nodes - drag in a folder of reference images, pipe the batch into Loop Start, and process each one in a single run. For anyone doing bulk img2img, batch upscaling, or "run these 40 references through the same workflow," it's the loader you've been missing.

    The inputs that matter

    • folder_path - an absolute path on disk. Note: unlike most loaders this reads any folder on your machine, not just ComfyUI's input directory. There's a Validate Folder button that checks the path and reports how many images it found before you commit to a run.
    • sort_by - name, modified_date, or created_date. File order matters when you're pairing with filenames, so don't skip this one.
    • max_images - 0 means unlimited; set 10 and only the first 10 load.
    • start_index - skip the first N images (good for resuming a half-finished batch).
    • include_subdirs - recurse into subfolders.
    • resize_mode - this one's the star: disabled, resize_to_first, resize_to_largest, resize_to_smallest. It normalizes every image to a common size so they can actually be batched together.

    Supported formats are png, jpg, jpeg, webp, bmp, gif; EXIF orientation gets fixed, and RGBA images keep their alpha channel (the pack treats that as a feature).

    The three outputs

    • images - a list of image tensors (the output is marked as a list, not a single batched tensor). That's deliberate: differently-sized images can't share one tensor, so you get a list. This is exactly what Loop Start expects to iterate over.
    • filenames - the loaded filenames, newline-separated, so you can match results back to source files.
    • count - how many loaded, as an INT.

    The resize trap, explained

    Here's the thing nobody warns you about: if you set resize_mode to disabled and your folder has images of different sizes, you'll get a list of differently-shaped tensors - and a bunch of downstream nodes will quietly refuse to work with that, or you'll discover the loop's accumulation falls back to a list instead of a batch (see Accumulate for the rule). If you plan to do anything tensor-batch-y downstream - concat, save as one batch, feed a batch sampler - set a resize mode. resize_to_first is the usual sane choice. The folder history in the widget means your last few folders are a click away, which sounds trivial until you're five projects deep.

    Installing it

    cd ComfyUI/custom_nodes
    git clone https://github.com/ThepExcel/ComfyAngel.git
    

    Restart ComfyUI, or search "ComfyAngel" in ComfyUI Manager. Pillow is the only dependency; no models.

    Common errors are honest ones: "Invalid folder path" when the path doesn't exist, "No valid images found" when the folder's empty of supported formats, and "No images after applying start_index" when you skip past the end. The folder widget's Validate button catches all three before you waste a run.

    CategoryComfyAngel/Loader

    Inputs (6)

    NameTypeDefaultDescription
    folder_pathSTRINGβ€”
    sort_byCOMBOname3 options: name, modified_date, created_date
    max_imagesoptINT00–1000β€”
    start_indexoptINT00–999999β€”
    include_subdirsoptBOOLEANfalseβ€”
    resize_modeoptCOMBOdisabled4 options: disabled, resize_to_first, resize_to_largest, resize_to_smallest

    Outputs (3)

    NameTypeDescription
    imagesIMAGEβ€”
    filenamesSTRINGβ€”
    countINTβ€”