ComfyUI Node

Load Image w/ Name

The LoadImage that hands you the filename — that's the whole trick

By TakkunRed·Created 5 months ago·Updated 5 months ago· 1
Load Image w/ Name
    • image
    • mask
    • image_name
    image

    Load Image w/ Name looks like a duplicate of the core LoadImage node, and in a way it is - it literally subclasses it. The entire difference is one extra output: alongside image and mask it also hands you the chosen filename as a STRING. That sounds trivial until you're trying to inspect an image's metadata, because the Metadata-Inspector workflow needs to know which file to read, and this node is how the pack keeps that in sync.

    What it actually is

    The README bills it as "input a filename via string or absolute path," which is a bit of an overclaim. In the code it's just INPUT_TYPES() inherited from ComfyUI's own LoadImage - so in practice it's the same image dropdown you already know, listing everything in your ComfyUI/input folder (plus subfolders). What the README got right is the part that matters: the node runs the standard load and returns the name back out.

    img, mask = super().load_image(image)
    return (img, mask, image)
    

    That's the whole mechanism. It's not a fancier loader; it's the stock one with a string output grafted on.

    Why you'd reach for it

    Because the pack's own README shows the intended workflow and it doesn't work without this node:

    1. Load Image w/ Name - pick your file from the dropdown.
    2. Wire its image_name output into Extract PNG Metadata's image_name input.
    3. Wire Extract PNG Metadata's metadata_json into JSON Tree Viewer.
    4. Queue and read your hidden prompt.

    Without the image_name string, you'd be typing the filename by hand into the extractor and praying you spelled it exactly like the loader's dropdown entry - including the subfolder, if it's nested. This node makes the extractor read exactly what you loaded, always. That one wire is the whole value.

    Inputs and outputs

    The input is the stock image dropdown (your input-folder files, defaulting to example.png). Outputs, left to right:

    • image (IMAGE) - the loaded image tensor, ready for img2img, VAE encode, or anything else a normal LoadImage feeds.
    • mask (MASK) - the alpha mask, same as core LoadImage; leave it dangling if your image has no alpha.
    • image_name (STRING) - the filename you selected, as text. This is the output that wires into the metadata extractor.

    Installing it

    It ships in the Metadata-Inspector pack, so you get all three nodes at once:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TakkunRed/ComfyUI-Metadata-Inspector.git
    

    Restart ComfyUI, or grab "ComfyUI-Metadata-Inspector" via ComfyUI Manager. No dependencies beyond what ComfyUI already has, no models to download.

    Gotchas

    • The default is example.png, which doesn't exist - and since Extract PNG Metadata defaults to the same fake filename, you can wire the whole pack up, queue, and get a "File not found" error. Pick a real file in the dropdown first.
    • The dropdown isn't free text. If you need a file outside the input folder, it won't show up here - copy it into ComfyUI/input, or skip this node and give Extract PNG Metadata an absolute path directly.
    • Rerun after changing the file. Like any loader, changing the dropdown doesn't re-extract metadata until you queue again.

    It's a quiet little utility - the kind of node that looks pointless until you've had to keep two nodes in sync by hand and realize you never want to do that again. That's its niche, and for the metadata-inspection workflow it's the right one to fill.

    Categoryimage

    Inputs (1)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png

    Outputs (3)

    NameTypeDescription
    imageIMAGE
    maskMASK
    image_nameSTRING