Nodes/IF_AI_LoadImages/IF Load Images S 🖼️
ComfyUI Node

IF Load Images S 🖼️

Load a whole folder of images in ComfyUI without touching your input dir

By if-ai·Created 2 years ago·Updated about a year ago· 17
IF 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

    ComfyUI's built-in Load Image node only ever shows you what's already sitting in your ComfyUI/input folder. Fine for one image. A real chore when you have a folder of 200 renders you want to upscale, or a dataset you want to img2img through on a loop. IF Load Images S is the node that fixes that one annoyance: point it at any folder on your disk, preview what's inside, and get the whole batch out as tensors you can wire straight into the rest of the graph.

    It comes from the Impact Frames family - same author (ImpactFrames on YouTube, if-ai on GitHub) behind the IF_AI_tools LLM/chat nodes. This one is much humbler: no API, no model downloads, no Ollama in sight. Just pillow, which ComfyUI already ships.

    How it works (and why it feels a bit hacky)

    The README is upfront about it: "This is a workaround solution, so it may feel a bit clunky but functions effectively." Knowing the actual mechanism explains most of the quirks:

    1. The Select Folder 📂 button opens a browser directory picker and drops the absolute path into the input_path field.
    2. Refresh Previews 🔄 POSTs that path to a custom server endpoint (/IF_img/refresh_previews). The backend scans the folder, sorts the files, and writes small 300px JPEG thumbnails into your ComfyUI input folder, prefixed thb_, with the subfolder structure encoded in the filename.
    3. The image dropdown lists those thumbnails, so you get a visual preview without loading anything at full resolution.
    4. When the queue runs, the node re-reads the real folder, applies your slicing, sorting and filtering, and loads only the selected range for real.

    That thumbnail-in-input-dir trick is why this works at all - and also why it pollutes your input folder.

    The inputs that matter

    • input_path - the folder. Absolute paths work; relative ones resolve against the input dir.
    • start_index / stop_index - the slice of the folder you want. The 0 → 10 default loads the first ten; combined with load_limit that's how you chew through a huge folder in chunks.
    • load_limit - a hard cap (10 to 100,000) on how many images load in one pass.
    • image_selected - single-image mode. Caveat: the README's TODO still lists "Fix single image upload" as unfinished, so treat this as the fiddly corner.
    • sort_method - alphabetical, numerical (natural sort, so frame_2 sorts before frame_10), or by created/modified date.
    • filter_type - restrict to png/jpg/webp/gif/bmp, or none for everything.
    • channel - which color channel becomes the mask; defaults to alpha.
    • include_subfolders - recurse or don't.

    Outputs: images (list of IMAGE) and masks (list of MASK built from your channel), image_paths and filenames (strings, handy for naming your Save nodes), count_str/count_int (like "3/120" and its index), plus the two you'll most often grab - images_batch and masks_batch, single batched tensors instead of lists.

    Two behaviors are baked in. Every image in a pass is resized to the largest dimensions in the batch, so mixed-resolution folders get squashed to a common size. And masks come from a color channel, not a model: for a PNG with transparency, alpha gives you a proper matte (the code inverts it to follow ComfyUI's mask convention). For opaque JPGs you get zeros. It's not a segmentation tool and doesn't pretend to be.

    Installing it

    ComfyUI Manager → search IF_AI_LoadImages → install, then restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/if-ai/ComfyUI_IF_AI_LoadImages
    

    Restart ComfyUI after. Dependencies are just pillow and numpy, which you already have - no model downloads, no keys.

    Where people get burned

    • The thb_ files show up in your normal Load Image browser. Thumbnails live in the input folder, so other image nodes list them. Harmless, but confusing the first time you see a folder full of 300px JPEGs you never created.
    • Backup Input / Restore Input are sharper than they sound. They move your input folder's contents to an input_backup dir and clear the folder. Don't click them out of curiosity while real files sit in input.
    • Folder picking needs a browser that supports directory selection. The JS uses webkitdirectory, so Chrome/Edge are fine, Safari is a coin flip.

    If you only need "load the next single image per queue run from a folder," WAS Node Suite's Load Image Batch is the more battle-tested pick. IF Load Images S wins when you want the whole batch at once, with previews, straight out of an arbitrary folder.

    CategoryImpactFrames💥🎞️/images

    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