Nodes/ComfyUI-Przewodo-Utils/BatchImagesFromPath
ComfyUI Node

BatchImagesFromPath

Skip the folder dance and load a whole directory

By przewodo·Created about a year ago·Updated 4 months ago· 4
BatchImagesFromPath
    • image
    path
    pattern

    You know the workflow: you've got a folder full of frames, crops, or reference images and you want all of them as one IMAGE batch - for an image-to-video model, a batch upscale, a comparison grid, whatever. Dragging them in one by one is misery, and ComfyUI's Load Image only does a single image. This node is the shortcut: point it at a directory, give it a pattern, and it loads everything that matches as a list of images.

    It's part of ComfyUI-Przewodo-Utils, one of those "I wrote this for my own workflow and published it" utility nodes. Nothing fancy, but it closes a real gap.

    How it works

    The node does three things: resolves the path, globs for files, and converts each to a tensor.

    • Path resolution. The path can be absolute, or relative to ComfyUI's output folder - the code runs it through ComfyUI's get_save_image_path, so a relative path like my_frames means <ComfyUI>/output/my_frames. If you give an absolute path that doesn't exist, the node will actually create the directory for you (that's a quirk of the implementation, not a feature to rely on).
    • Pattern matching. A standard glob pattern. *.jpg, image_*.png, whatever. Leave it empty and it loads all image files in the folder. It globs non-recursively, so subdirectories are not searched - if you want recursive scanning, this isn't the node.
    • Loading. Each file goes through PIL, gets EXIF_TRANSPOSEd (so phone photos load with the correct orientation, a detail most loader nodes skip), and is converted to a float tensor normalized to 0–1.

    The output, named image, is a list of IMAGE tensors - one per file, in glob order (which is basically alphabetical by filename).

    The inputs that matter

    • path - directory to scan. Absolute, or relative to the output folder.
    • pattern - glob pattern; empty means "everything."

    That's it. Two text boxes, one output.

    Installing it

    From ComfyUI Manager, search ComfyUI-Przewodo-Utils. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/przewodo/ComfyUI-Przewodo-Utils.git
    

    Restart ComfyUI. This node's dependencies are just PIL and torch - the pack's heavier requirements (teacache, gguf, wanblockswap, Rife-TensorRT) are for the video sampler and don't affect it.

    Where people get burned

    • The relative-path rule surprises everyone once. If you type C:/Users/you/frames you get your absolute path. If you type frames expecting it to look next to the workflow, you're looking at <ComfyUI>/output/frames instead. The node even tells you what path it resolved to in the console - read that line before hunting for files.
    • Pattern typos silently return nothing. If nothing matches, the node returns None, and whatever you wired downstream will just fail with a confusing error. Start with the pattern empty to confirm the folder loads, then narrow it down.
    • Memory. Every matched image lands in the batch at once. A folder of 4K frames will happily eat VRAM. Load only what you need with a tighter pattern, or you'll blame the wrong node when you OOM.
    CategoryPrzewodoUtils

    Inputs (2)

    NameTypeDefaultDescription
    pathSTRINGDirectory path containing images to batch load. Can be absolute or relative to ComfyUI output folder.
    patternSTRINGFile pattern to match images (e.g., '*.jpg', '*.png', 'image_*.jpeg'). Leave empty to load all image files.

    Outputs (1)

    NameTypeDescription
    imageIMAGE