Nodes/ComfyUI_RaykoStudio/๐ŸฆŠ RS Load Images From Dir
ComfyUI Node

๐ŸฆŠ RS Load Images From Dir

Batch-load a whole folder of images โ€” and keep the alpha

By RaykosanยทCreated about a year agoยทUpdated a day agoยท 79
๐ŸฆŠ RS Load Images From Dir
    • image
    • filename
    • folder_path
    • number_of_files
    โ—„node_data{}โ–บ
    โ—„folder_pathโ–บ
    โ—„filter_type*.pngโ–บ
    โ—„start_index1โ–บ
    โ—„end_index1โ–บ
    โ—„custom_filter*.pngโ–บ

    You know the grind: a folder of 40 images that all need the same upscale, the same img2img pass, or the same mask edit - and ComfyUI's Load Image only does one at a time. RS Load Images From Dir is the batch loader that fixes it. Point it at an absolute folder path, optionally filter by extension, and it hands you the whole batch as a list, with the filenames and folder alongside. Two details make it nicer than most directory loaders: it keeps the alpha channel when the source has one, and it preserves original resolution - no silent downscaling or dropped transparency.

    How it works

    You give it a directory and it globs the files. The workflow-friendly inputs:

    • folder_path - an absolute path to any folder on your machine (not just ComfyUI's input/). The ๐Ÿ“ Select folder button fills it, and there's a Paste button for the clipboard.
    • filter_type - pick a built-in filter (*.png, *.jpg, *.jpeg, *.webp, *.bmp, *.gif, *.*) or custom to use your own glob.
    • start_index / end_index - 1-based inclusive range, so you can process "just files 5 through 12" without touching the folder.
    • custom_filter - the optional glob used when filter_type is custom. This is the one that lets you do *_mask.png or *_upscaled.png and pull only a specific subset out of a mixed folder.

    Outputs: image (a list of IMAGE tensors), filename (the matching filenames), folder_path, and number_of_files (an INT with the count, handy for loop logic). node_data is the JSON the custom UI maintains internally - you never touch it.

    Where it earns its keep

    The killer use cases are the ones where "load one image, run, load next, run" would drive you insane:

    • Batch upscaling. Folder in โ†’ RS Load Images From Dir โ†’ RSUpscaler โ†’ save. Every image at once.
    • Batch img2img or batch mask editing, feeding the list into any node that accepts a batch and saving with %batch_num% in the prefix.
    • Feeding RaykoStudio's own batch machinery - RS Image Adjustments batch mode and RS Outpaint's multi-image batch mode both expect a loader like this. Arm batch once, and one queue press walks the whole folder.
    • RGBA preservation. If your pipeline needs transparency (compositing, overlays, stickers on top of generated scenes), this loader is the one that doesn't flatten it.

    Common issues

    • The Paste button is browser-dependent. In Chrome and Edge it works immediately after a one-time clipboard permission; in Firefox it pops up an extra dialog. That's a browser security rule, not a bug - and Ctrl+V into the field always works.
    • Long paths get truncated from the front so you can always see the actual folder name - that's the UI, not an error.
    • Empty result - check the filter_type actually matches your files. If you have .jpg files and a *.png filter, you get zero, and number_of_files will tell you so.

    Installing it

    It ships with the RaykoStudio pack. ComfyUI Manager โ†’ search ComfyUI_RaykoStudio โ†’ install, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Raykosan/ComfyUI_RaykoStudio
    

    Restart ComfyUI afterward. Dependencies (pycairo, opencv-python, scipy, Pillow>=10) install via Manager; a manual clone wants pip install -r requirements.txt in the node folder. Apache 2.0, tested on ComfyUI 0.15+, Python 3.10+, Torch 2.8+.

    Category๐ŸฆŠ RaykoStudio

    Inputs (6)

    NameTypeDefaultDescription
    node_dataSTRING{}โ€”
    folder_pathSTRINGโ€”
    filter_typeCOMBO*.png8 options: *.*, *.png, *.jpg, *.jpeg, *.webp, *.bmp, +2
    start_indexINT11โ€“999999โ€”
    end_indexINT11โ€“999999โ€”
    custom_filteroptSTRING*.pngโ€”

    Outputs (4)

    NameTypeDescription
    imageIMAGEโ€”
    filenameSTRINGโ€”
    folder_pathSTRINGโ€”
    number_of_filesINTโ€”