Nodes/APZmedia Naming Tools/APZmedia Load Image with Filename
ComfyUI Node

APZmedia Load Image with Filename

The Load Image that tells you the filename — same image, two extra string outputs

By APZmedia·Created 2 years ago·Updated 5 months ago· 8
APZmedia Load Image with Filename
    • image
    • mask
    • filename
    • filename_without_ext
    image

    ComfyUI's built-in Load Image node discards the filename the moment it has the pixels. That's a real problem when your pipeline is named by convention - your input is ACME-EP01-SH010-beauty.png and you'd like your output to remember it came from EP01-SH010 - but the standard node gives you no way to get the name back out. APZmedia Load Image with Filename is a drop-in replacement that doesn't throw that information away.

    It's an exact behavioral clone of the core Load Image for everything that matters: same image picker, same upload button, same handling of subfolders, EXIF rotation, alpha-to-mask conversion, and the same IMAGE and MASK outputs. Swap it into an existing workflow and every wire that fed from the old Load Image keeps working - that's the "drop-in" promise, and the source confirms it's essentially the core node plus a filename grab. The trick is when it grabs the name: it intercepts the file path before the tensors are built, pulls os.path.basename() and os.path.splitext(), and hands you both:

    • filename - full name including extension, e.g. ACME-EP01-SH010-beauty.png
    • filename_without_ext - the same without the extension, e.g. ACME-EP01-SH010-beauty

    Those two STRING outputs are the whole reason this node exists. filename_without_ext is the one you'll actually wire somewhere, because it's the natural input to APZmediaStringStripper - define project-episode-shot-pass, keep episode,shot, and you've recovered the shot ID from the file you loaded, ready to stamp onto the output name. You can also feed it through APZmediaTextToHash for a stable ID, or straight into a filename builder.

    The one input is image, the same file picker you already know. And the node keeps the core node's content-hash IS_CHANGED behavior, meaning if you replace the file on disk with a different image, ComfyUI re-executes the graph - no stale-cache confusion.

    This is quietly the most useful node in the pack for anyone doing img2img or batch work where the output should inherit identity from the input. The README's framing is apt: the standard node behaves "like a contractor who stops returning calls after the deposit clears." This one hands you the paperwork.

    Install

    ComfyUI Manager → search "APZmedia Naming Tools". Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/APZmedia/ComfyUI-APZmedia-cleanName-from-string
    cd ComfyUI-APZmedia-cleanName-from-string
    pip install -e .
    

    Restart, find it under APZmedia. No models, no downloads - the only pack dependency is unidecode, which this node doesn't even need. It reuses ComfyUI's own image-loading machinery, so if the core Load Image works on your setup, this will too.

    CategoryAPZmedia

    Inputs (1)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png

    Outputs (4)

    NameTypeDescription
    imageIMAGE
    maskMASK
    filenameSTRING
    filename_without_extSTRING