Nodes/ComfyUI-PepeUtils/Pepe Load Images From Folder
ComfyUI Node

Pepe Load Images From Folder

Load images from any local folder as synchronized lists

By Pepehoschi·Created 5 months ago·Updated 2 days ago· 0
Pepe Load Images From Folder
    • images
    • masks
    • file_name
    • image_count
    folder
    image_load_cap0
    select_every_nth1

    ComfyUI's built-in LoadImage only reads from its input folder. That's a deliberate safety choice - the loader sits behind a restricted resolver that refuses absolute paths - but it's also a pain the moment your images live somewhere else on disk: a training set, a folder of frames, a stack of reference shots. Pepe Load Images From Folder sidesteps that by reading an arbitrary local folder directly and handing you synchronized lists of images, masks, and filenames. If you've ever copied a hundred files into input/ just to batch-process them, this is the node that makes that chore disappear.

    How it works

    Give it a folder path and it scans for image files - BMP, GIF, JPEG, PNG, TIFF, and WebP. Two filters keep big folders manageable: image_load_cap (0 loads everything) and select_every_nth (2 grabs every other file, great for thinning a dense sequence). Filenames are sorted case-insensitively, so the three outputs always line up deterministically no matter what order the filesystem reports.

    The design choice that matters is that it emits lists, not one stacked batch. The images, masks, and file_name outputs are all is_list outputs, which means downstream nodes process each file independently instead of getting one giant tensor of every image at once. For per-file workflows - captions, per-frame work, anything where each image needs its own processing and its own name - that's the difference between this node working and the whole batch silently merging.

    The mask output is derived from the alpha channel (1 − alpha), so transparent PNGs give you a real mask for free, and images without alpha get an all-zero mask. The file_name output keeps the original extension, which is exactly what you need for the dataset sidecar convention: same basename, .txt alongside. The README's recipe is to send file_name through a regex replace - \.[^.]+$ to an empty string - then feed the result and your generated text to a text-saving node. Instant caption dataset.

    Inputs and outputs

    • folder - absolute path to a directory.
    • image_load_cap (0 = all) and select_every_nth (default 1).
    • Outputs: images (list), masks (list), file_name (list, with extension), image_count (int).

    Two backend details worth trusting: it hashes the folder's contents (names, sizes, modification times) in IS_CHANGED, so it re-runs when files change instead of serving you a stale cache - and it validates that the folder exists before loading, giving you a clear error instead of a silent empty batch.

    Installing it

    Same pack as the rest:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Pepehoschi/ComfyUI-PepeUtils.git
    

    or ComfyUI Manager → ComfyUI-PepeUtils, restart. No extra dependencies.

    Gotchas

    The flip side of bypassing the resolver: a workflow you share references absolute paths that won't exist on someone else's machine. That's inherent to this kind of node, but it's worth remembering before you hand a folder-loader workflow to a friend. And if you plug images into a node expecting a single batch tensor, remember the list behavior - combine it first if that's what you actually want.

    CategoryPepe Utils/image

    Inputs (3)

    NameTypeDefaultDescription
    folderSTRING
    image_load_capINT00–999999
    select_every_nthINT11–999999

    Outputs (4)

    NameTypeDescription
    imagesIMAGE
    masksMASK
    file_nameSTRING
    image_countINT