Nodes/ComfyUI-IF_AI_tools/IF tools Load Images S🖼️
ComfyUI Node

IF tools Load Images S🖼️

Load a whole folder of images at once — the batch feeder for captioning and prompt reversal

By if-ai·Created 2 years ago·Updated 12 months ago· 701
IF tools Load Images S🖼️
    • images
    • masks
    • image_paths
    • filenames
    • count_str
    • count_int
    • images_batch
    • masks_batch
    image
    input_path
    start_index0
    stop_index10
    load_limit1000
    image_selectedfalse
    available_image_count1
    include_subfolderstrue
    sort_method
    filter_type
    channelalpha

    IF tools Load Images S is the batch-feeder node for the IF_AI pack. The LLM nodes in this pack - IF Image to Prompt, IF Prompt Maker, IF Chat Prompt - all accept image lists, and this is the node that makes those lists worth having. Point it at a folder of reference images and it hands you the whole set as a list, ready to feed into captioning or prompt-reversal loops. It's the difference between processing one image at a time and running your whole reference library through the LLM in one go.

    Unlike ComfyUI's built-in Load Image, which is a pick-one-and-forget widget, this node is built for range and repetition: start/stop indices, sorting, subfolder recursion, and per-channel mask extraction for when you're pulling alpha or color-channel data along with the pixels.

    How it works

    Under the hood it uses the pack's ImageManager to enumerate files in a directory - by default your ComfyUI input folder, with input_path letting you point elsewhere (relative paths resolve against input; absolute paths work too). It collects matching files, sorts them by sort_method (alphabetical, numerical, date_created, date_modified), filters by extension via filter_type, then slices out the start_index to stop_index range you asked for.

    The channel input (alpha, red, green, blue) drives mask generation - pick alpha and you get transparency masks for every loaded image. The node even marks itself as always-changed (IS_CHANGED returns NaN), so the list refreshes every execution rather than caching a stale folder listing - which is exactly what you want when files are being added between runs.

    The inputs that matter

    • input_path - the folder to scan (relative to ComfyUI's input dir).
    • start_index / stop_index - the slice of the sorted list to actually load.
    • include_subfolders - recurse or not.
    • sort_method - matters more than you'd think; it determines the order the LLM sees your images in.
    • channel - the color channel used for the mask outputs.

    The output list is generous. images and masks come as lists (one per file), plus image_paths, filenames, count_str and count_int so downstream logic knows what it's working with. There are also two batch outputs - images_batch and masks_batch - that stack everything into a single batched tensor for nodes that want one blob instead of a list.

    Installation

    Standard for this pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/if-ai/ComfyUI-IF_AI_tools.git
    pip install -r requirements.txt
    

    Or "IF_AI_tools" via ComfyUI Manager, then restart. No model downloads.

    Gotchas

    The one thing that trips people: load_limit caps how many files get enumerated, and the available_image_count field is read-only - it shows what the node sees in the folder. If your library is bigger than the limit, raise it. And because the node forces a refresh every run, don't be surprised that the listing updates constantly; that's a feature when you're dumping new images into the folder mid-session. It's a chunky node in an archived pack, but folder loading is one of those tools that keeps working long after the pack stops evolving.

    CategoryImpactFrames💥🎞️/IF_tools

    Inputs (11)

    NameTypeDefaultDescription
    imageCOMBO0 options:
    input_pathSTRING
    start_indexINT00–9999
    stop_indexINT101–9999
    load_limitCOMBO10005 options: 10, 100, 1000, 10000, 100000
    image_selectedBOOLEANfalse
    available_image_countINT10–99999
    include_subfoldersBOOLEANtrue
    sort_methodCOMBO4 options: alphabetical, numerical, date_created, date_modified
    filter_typeCOMBO7 options: none, png, jpg, jpeg, webp, gif, +1
    channelCOMBOalpha4 options: alpha, red, green, blue

    Outputs (8)

    NameTypeDescription
    imagesIMAGE
    masksMASK
    image_pathsSTRING
    filenamesSTRING
    count_strSTRING
    count_intINT
    images_batchIMAGE
    masks_batchMASK