Nodes/ComfyUI-ImageAlphaCrop/Load Images From Path (RGBA)
ComfyUI Node

Load Images From Path (RGBA)

Load Images From Path (RGBA) — a whole folder of transparency, in one shot

By swan7-py·Created 10 months ago·Updated 10 months ago· 4
Load Images From Path (RGBA)
    • IMAGE
    • MASK
    • FILE PATH
    directory
    image_load_cap0
    start_index0
    load_alwaysfalse

    ComfyUI's built-in Load Image opens one file at a time from the /input browser. That's fine for a single image and miserable when you've got a folder of cutout PNGs to process. Load Images From Path (RGBA) skips the browser entirely: you give it a filesystem path and it pulls in every image in that folder, converted to RGBA, with the alpha channel handed to you separately as a mask. Batch asset prep, basically.

    It's the batch front end of this little pack (swan7-py's ComfyUI-ImageAlphaCrop), which exists because ComfyUI's default load/save is RGB + separate mask and that makes full RGBA pipelines awkward. This node and its single-image sibling Load Image (With Alpha) are the load side of that; Image Alpha Crop and Save Image (RGBA) are the crop and save side. String them together and a whole folder of logos goes in, gets trimmed, and comes out saved with transparency intact.

    How it works

    Point it at a directory and it scans for .jpg, .jpeg, .png, .webp, and .bmp files, sorts them alphabetically, skips start_index files off the front, and stops after image_load_cap files (0 means unlimited). Every file is opened, EXIF-transposed, and converted to RGBA - so a JPEG gets a fully opaque alpha slapped on, and a PNG keeps its real one. Each image comes out three ways at once:

    • IMAGE - the RGBA image tensor
    • MASK - the alpha channel as a mask tensor
    • FILE PATH - the absolute path, as a string

    Important: all three outputs are lists, one entry per image - not a single batched tensor. That's actually convenient for downstream use: ComfyUI will expand the list into a batch when you wire it into a node that expects a plain IMAGE input (like Image Alpha Crop), and you get the per-file path list for free if you want to track provenance or feed a path-based saver.

    The inputs that matter

    • directory - required. This is a plain filesystem path, not the /input picker. Absolute paths are the safe choice.
    • image_load_cap - cap the number of images loaded. Great for testing a workflow on a handful before committing to the whole folder.
    • start_index - skip the first N sorted files, for resuming or chunking a folder.
    • load_always - when enabled, the node re-reads the folder on every execution and never caches. Turn this on if files are being written into the folder by something else and you want them picked up.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/swan7-py/ComfyUI-ImageAlphaCrop
    

    then restart ComfyUI. Or search "ImageAlphaCrop" in ComfyUI Manager - it's on the Comfy Registry, one-click install. No models, no extra pip dependencies; it runs on the numpy/torch/Pillow that ship with ComfyUI.

    Gotchas

    Two things bite people. First, it will throw a FileNotFoundError if the directory doesn't exist, has no readable files after filtering, or your start_index leaves nothing left - so double-check the path and the cap before you queue. Second, "RGBA" in the name doesn't mean it only loads PNGs. It happily loads JPEGs and converts them to opaque RGBA, which is useful, but don't mistake a JPEG's fake alpha for real transparency - that's the file's fault, not the node's.

    It also reads the folder at queue time, so if you change files between runs you may want load_always on; otherwise the node's cache may skip the reload. Not a security concern like some loaders - this one never touches network or model files, it just reads a directory you pointed it at.

    CategorySwan

    Inputs (4)

    NameTypeDefaultDescription
    directorySTRING
    image_load_capoptINT0
    start_indexoptINT00–18446744073709550000
    load_alwaysoptBOOLEANfalse

    Outputs (3)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK
    FILE PATHSTRING