Nodes/ComfyUI-Enhancement-Utils/Load Image (With Subfolders)
ComfyUI Node

Load Image (With Subfolders)

Your images are in subfolders — this loader actually finds them

By phazei·Created 5 months ago·Updated 22 days ago· 33
Load Image (With Subfolders)
    • image
    • mask
    • metadata
    • imagedata
    image
    folder_path
    folder_image

    If you've ever built a workflow around a pile of reference images, you know the pain this node is here to fix: ComfyUI's stock Load Image gives you one giant dropdown that treats every file in input/ as flat. The moment you organize things into folders, you're squinting at a thousand filenames and hoping the right 0012.png is in there. This loader, from the ComfyUI-Enhancement-Utils pack by phazei, scans the input directory recursively and shows subfolders as subfolder/filename.png - no more guessing which directory a file came from.

    It does one more thing the stock node won't: it reads the workflow metadata back out of the file. Since every ComfyUI PNG carries its generation graph embedded in PNG text chunks, this node hands you that data as a JSON string on an output wire. That makes it a genuinely useful companion to an entire workflow-recovery workflow, not just a nicer file picker.

    How it works

    The node walks the input directory with os.walk, prunes junk (.DS_Store, Thumbs.db, dot-folders, the clipspace temp folder), and filters to actual image files using ComfyUI's own MIME detection. It also ships a small HTTP middleware that fixes a real Nodes 2.0 bug: the new frontend builds thumbnail URLs that break whenever a filename contains a subfolder, so subfolder image previews 404 on stock ComfyUI. This pack rewrites those requests on the fly. Nice touch, and a sign the author actually uses the thing.

    There are two ways to point it at an image. Default mode uses the image dropdown. The more interesting path is custom-folder mode: set folder_path to an absolute path (or one relative to input/), and it switches to scanning that folder instead, with folder_image auto-populated as a second combo. The widgets hide or show depending on which mode you're in. You can even drive folder_image from a Primitive node.

    The inputs and outputs that matter

    You set image (default mode) or folder_path + folder_image (custom mode). That's it. The outputs are where it gets good:

    • image (IMAGE) - the loaded tensor. It handles multi-frame GIF/APNG/TIFF, 16-bit I-mode images, and palette transparency, matching the built-in loader's robustness.
    • mask (MASK) - the alpha channel as a mask, or zeros if the image has none.
    • metadata (STRING) - embedded metadata as JSON, including prompt and workflow (from PNG text chunks, WebP EXIF, or JPEG EXIF). Empty {} if the file has none.
    • imagedata (STRING) - file stats as JSON: filename, path, width, height, resolution, size_bytes.

    One breaking change to know about: before v1.3.0 there was a standalone prompt output. It's gone - the prompt now lives inside the metadata JSON. To get structured values back out, feed metadata into the pack's own Parse JSON (EnhUtils) node, which turns that string into an object you can index into.

    Installing it

    The pack installs cleanly with no model downloads - its only real Python requirements are psutil and piexif. In ComfyUI Manager, search "Enhancement Utils". Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/phazei/ComfyUI-Enhancement-Utils.git
    cd ComfyUI-Enhancement-Utils
    pip install -r requirements.txt
    

    Then restart ComfyUI.

    Where people get burned

    • Custom-folder mode throws if folder_path is set but folder_image is empty - the combo needs a beat to populate after you type a path. Pick the file, then run.
    • WebP metadata needs piexif. It's in requirements.txt, so a Manager install gets it; a bare clone without the pip step silently returns {} for WebP.
    • On the Nodes 2.0 (Vue) renderer, the on-node preview and MaskEditor don't work in custom-folder mode. The image still loads and outputs correctly; only the preview is legacy-canvas. The pack's own README says so plainly.
    • Remember metadata is a JSON string. It's {} for images that were stripped or never had chunks - re-encoded JPEGs and screenshots carry nothing, as always.
    Categoryimage

    Inputs (3)

    NameTypeDefaultDescription
    imageCOMBOSelect an image from the input directory. Subfolders are fully supported.
    folder_pathoptSTRINGAbsolute path or path relative to the input directory. When set, overrides the image dropdown above. The folder is scanned recursively for images.
    folder_imageoptCOMBOPick an image from the custom folder. Populated automatically when folder_path is set.

    Outputs (4)

    NameTypeDescription
    imageIMAGE
    maskMASK
    metadataSTRING
    imagedataSTRING