Nodes/ComfyUI-Prompt-Helper/Load Image List (dir)
ComfyUI Node

Load Image List (dir)

The folder loader that tolerates mixed sizes

By Elypha·Created 2 years ago·Updated 12 months ago· 0
Load Image List (dir)
    • IMAGE
    • MASK
    • INDEX
    • FILENAMES
    directory
    skips0
    sort_by
    trim_suffixfalse
    recursivefalse

    Same family as Load Image Batch (dir), one crucial difference: instead of stacking every image into a single batch tensor, this node hands you each image as its own item. Every output - IMAGE, MASK, INDEX, FILENAMES - is a list of one entry per image. No batching, no dimension police. If your folder contains mixed resolutions, or your downstream node wants to chew through images one at a time, this is the loader you want.

    The inputs are identical to its batch sibling: directory (absolute path), skips, sort_by, recursive, trim_suffix. The sort_by options are worth knowing because they make order deterministic - text asc/desc, number asc/desc (it pulls the first number out of each filename, so frame_001, frame_002... sort correctly), or file modification time. skips drops the first N files off the sorted list, which is handy when a folder has a thumbnail you don't want.

    Why would you choose a list over a batch when both exist? Two reasons, and both are about what the rest of your graph wants:

    1. Mixed sizes. A list of tensors has no "all the same shape" requirement, so a folder of different-sized images just works.
    2. List-friendly downstream nodes. ComfyUI's ecosystem has a whole family of nodes that take IMAGE lists and process each element independently - and those downstream nodes are exactly where INDEX and FILENAMES come in handy, since you can track which output belongs to which input as it flows through.

    The mask behavior is the same as the batch version: each image's alpha channel becomes its mask, so a transparent PNG arrives with a ready-made matte.

    The inputs and outputs at a glance

    • directory (required) - absolute path to the folder
    • skips, sort_by, recursive, trim_suffix (optional) - same as the batch loader
    • Outputs: IMAGE, MASK, INDEX (0-based position of each image), FILENAMES - all lists

    Installing it

    Zero extra dependencies, no model downloads - ComfyUI-Prompt-Helper only uses what ComfyUI already installs. ComfyUI Manager → ComfyUI-Prompt-Helper, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/elypha/ComfyUI-Prompt-Helper
    

    Restart, and it's under image.

    Rule of thumb: same-size folder and you want a single batch → use the batch loader. Different sizes, or you want per-image routing → this one. Between the two, most folder-processing workflows are covered.

    Categoryimage

    Inputs (5)

    NameTypeDefaultDescription
    directorySTRING
    skipsoptINT00–9223372036854776000
    sort_byoptCOMBO7 options: None, As Text (Asc), As Text (Desc), As Number (Asc), As Number (Desc), Time Modified (ASC), +1
    trim_suffixoptBOOLEANfalseIf enabled, FILENAMES output will have the file suffix removed.
    recursiveoptBOOLEANfalseIf enabled, the directory will be searched recursively.

    Outputs (4)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK
    INDEXINT
    FILENAMESSTRING