ComfyUI Node

Easy Load Image

A Load Image that gives you the filename back

By mengod-gh·Created 3 months ago·Updated 3 months ago· 0
Easy Load Image
    • IMAGE
    • MASK
    • filename
    • stem
    • extension
    • relative_path
    image

    ComfyUI's built-in Load Image throws the filename away. It hands you pixels and a mask, and then the name is gone - retype it, or go dig through input/ by hand. That's a non-problem when you're generating one image, and a real annoyance the moment you're processing a folder and want each output to keep its input's name. This node is the fix, and it's about as simple as a fix gets: same loading, but the filename rides along as data.

    It comes from ComfyUI-Easy-Image-Nodes, a small MIT-licensed pack by mengod-gh built around one idea - load an image, process it, save it back under the same name. Easy Load Image is the load half. It has exactly one widget to worry about.

    The one input

    image is a string path relative to ComfyUI/input. You'll barely type it: the node has a "choose image to upload" button that uploads a file from your disk into input/ and fills the field for you. That's the normal flow, and it's the same three-directory convention every ComfyUI loader uses - the node will only ever read from input/.

    The outputs that matter

    Beyond the usual IMAGE tensor you get four string outputs that are pure gold for dataset work:

    • filename - sample.png, full name with extension
    • stem - sample, no extension
    • extension - .png, lowercase with the dot
    • relative_path - the path including any subfolders under input/

    Wire relative_path into a save node and your processed output lands back under the original name, subfolders intact - no retyping, no rename step. There's also a MASK output derived from the image's alpha channel: opaque pixels are 0, transparent pixels are 1. So a transparent PNG keeps its transparency through the graph instead of silently flattening to black or white.

    How it works

    The node only reads inside ComfyUI/input - absolute paths and .. traversal are rejected outright, which is more than some bigger packs bother with. It validates the extension against a whitelist (.png/.jpg/.jpeg/.webp/.bmp/.tif/.tiff), applies EXIF orientation, and converts through RGBA, so the mask genuinely reflects alpha rather than being a guess. One nice touch: its change-detection hashes the file, so if you overwrite the source in input/ between runs, the node notices and re-executes instead of serving you a stale cached result.

    Where people get burned

    The path has to live under input/. You can't point it at an absolute path elsewhere on your disk, and a .. errors rather than silently escaping - that's the security model working, not a bug. And remember the MASK polarity: 1 means transparent. If you're wiring it into inpainting that expects 1 = the region to fix, this is already what you want; if your pipeline assumes the opposite, you'll see it immediately.

    Install

    It's in ComfyUI Manager under "ComfyUI-Easy-Image-Nodes" (search "Easy Image Nodes"), or from a terminal in your custom_nodes directory:

    cd /path/to/ComfyUI/custom_nodes
    git clone https://github.com/mengod-gh/ComfyUI-Easy-Image-Nodes.git
    

    Restart ComfyUI after. No model downloads, no extra Python dependencies - it's plain torch and PIL built on ComfyUI's own folder handling, which is partly why it's so painless.

    If you only ever generate single images, this node is optional. If you're building a dataset pipeline, it's the load half of the exact loop you'll be doing all week.

    CategoryEasy Image Nodes

    Inputs (1)

    NameTypeDefaultDescription
    imageSTRING

    Outputs (6)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK
    filenameSTRING
    stemSTRING
    extensionSTRING
    relative_pathSTRING