Nodes/NH-Nodes/Load Image Info (NH)
ComfyUI Node

Load Image Info (NH)

Load an image and get its filename and path out the other side

By jetthuangai·Created 5 months ago·Updated 21 days ago· 6
Load Image Info (NH)
    • image
    • mask
    • file_name
    • path
    image
    filename_extensiontrue
    path_include_filenametrue

    ComfyUI's built-in Load Image gives you the pixels and nothing else. Load Image Info (NH) (class NH_LoadImageInfo) is the version that also hands you the file_name and path as strings - which sounds minor until you want to name your outputs after the source, log where an image came from, or route by filename. It's the metadata-aware loader the pack's README points at, and it's the natural front end for the NH loading family.

    How it works

    It's a straight port of the core Load Image behavior - file picker, alpha channel handling, EXIF transpose - with two toggles that shape the string outputs:

    • filename_extension (default true) - whether file_name includes the extension. Flip it off and photo_001.png becomes photo_001.
    • path_include_filename (default true) - whether path includes the filename itself or just the folder. With it on, path is the full file path; off, you get the directory.

    Outputs are image (the IMAGE tensor), mask (the inverted alpha, same convention as core ComfyUI), file_name, and path. If you've used the core node, everything here behaves the way you expect - this one just surfaces the metadata that ComfyUI normally swallows.

    Where you'd actually use it

    Pair it with the pack's filename tooling or a save node that can accept a name input, and your output filenames stop being ComfyUI_00001_ and start being the source image's name. It also composes with the logic layer: file_name feeds a List Create (NH)/List Filter (NH) pipeline or a switch, so you can branch behavior on which image came in. The README's suggested workflow is exactly this - load with metadata, use file_name/path for naming outputs or routing.

    Installing

    ComfyUI Manager → search NH-Nodes → install → restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jetthuangai/NH-Nodes.git
    cd NH-Nodes
    pip install -r requirements.txt
    

    Restart and refresh the browser tab. Pillow/numpy only - no heavy deps for this node.

    Gotchas

    The mask is inverted-alpha, like core ComfyUI, so if you're used to "white = opaque" from some other tool, double-check before wiring it into a mask pipeline. And the string outputs are relative to ComfyUI's input folder as ComfyUI resolves it, not necessarily an absolute OS path - that catches people who paste the path straight into a script. Minor: there's no repeat/batch-loading here; if you need a folder of images, that's Load Images Folder (NH).

    CategoryNH-Nodes/Image

    Inputs (3)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png
    filename_extensionBOOLEANtrue
    path_include_filenameBOOLEANtrue

    Outputs (4)

    NameTypeDescription
    imageIMAGE
    maskMASK
    file_nameSTRING
    pathSTRING