Nodes/ComfyUI-BmzUtils/[BMZ] LoadImage
ComfyUI Node

[BMZ] LoadImage

LoadImage, but it tells you what it loaded

By bmalhz·Created 7 months ago·Updated 6 months ago· 0
[BMZ] LoadImage
    • image
    • mask
    • image_path
    image

    The stock LoadImage node has a quiet hole in it: it hands you the pixels and a mask, but never tells you which file it loaded. BmzLoadImage from ComfyUI-BmzUtils is that same node with one extra wire - an image_path string output - and it's one of those additions you don't want until the moment you desperately need it.

    Why you'd reach for it

    ComfyUI's default loaders are deliberately dumb about filenames - the workflow lives in the PNG metadata, not in what the file is called. But every now and then the filename genuinely matters. You're writing a batch of outputs next to their sources, you're pulling a caption sidecar with the same base name as the image, you're stamping the source file into a filename prefix so you can tell generations apart. Stock LoadImage can't help with any of that; the name is internal and thrown away. BmzLoadImage keeps the chain.

    How it works

    Under the hood it's honest about being a subclass: BmzLoadImage inherits directly from ComfyUI's core LoadImage, calls the same load_image() under the hood, and simply passes the chosen filename through as a third output. You get the exact same image picker with the upload button, the same IMAGE and MASK outputs - plus image_path, a STRING holding the file's name relative to your ComfyUI/input/ directory.

    One genuine difference from stock: the file list is built by walking the input directory recursively, so images sitting in subfolders show up in the dropdown instead of only ones in the top level. If you keep a tidy input/ with per-project subfolders, that's a small quality-of-life win that stock LoadImage doesn't give you.

    Inputs and outputs that matter

    • image - the picker. Select or upload; uploads land in input/ exactly like the core node.
    • image (output) - the loaded tensor, IMAGE type, ready for anything.
    • mask - the MASK output, present even when the file has no alpha (empty mask).
    • image_path - the string that makes this node worth installing. Note it's the name relative to input/, not an absolute path - you'll usually feed it into a filename_prefix on a SaveImage or prepend input/ yourself if you want a filesystem path.

    Installing it

    It's one of the four nodes in the ComfyUI-BmzUtils pack, so it arrives with the rest. ComfyUI Manager: search "ComfyUI-BmzUtils", install, restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/bmalhz/ComfyUI-BmzUtils
    

    It has no dependency beyond core ComfyUI - the pack's requirements.txt only lists jinja2 (for a different node in the pack), so this one is pure drop-in.

    Where people trip up

    Because it walks subfolders, a bloated input/ with thousands of files makes the dropdown long - that's the cost of the recursion, and it's the main thing you'll notice. Also remember the outputs are what they are: image_path is not a magic file handle, just a string. If you're piping it into a filename prefix that already ends in .png, you'll get name.png.png; chop the extension yourself. And if you're expecting this node to write metadata into the loaded image - it doesn't; that's a SaveImage concern, covered by the workflow-in-PNG convention. For the narrow job of "load it and tell me its name," it does exactly that, and nothing else, which is the right size for a utility node.

    Categoryimage

    Inputs (1)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png

    Outputs (3)

    NameTypeDescription
    imageIMAGE
    maskMASK
    image_pathSTRING