Nodes/Sage Utils/Load Image
ComfyUI Node

Load Image

Load Image, but with the alpha, the dimensions, and the metadata all handed to you

By arcum42·Created 2 years ago·Updated 22 days ago· 33
Load Image
    • image
    • mask
    • width
    • height
    • metadata
    image_nameexample.png

    ComfyUI's built-in Load Image is fine. It loads an image. But if you've ever wanted to know an image's dimensions inside the graph, or extract the metadata that's embedded in a PNG you downloaded from Civitai, the stock node makes you add extra nodes for each thing. Load Image from Sage Utils is the version that hands you everything at once: the image, its alpha as a mask, its width, its height, and its embedded metadata - five outputs off a single node.

    It's one of those "why isn't this in core" quality-of-life nodes, and it's a good entry point to the pack's whole philosophy: fewer nodes doing the same work, more information flowing through the graph.

    How it works

    Like the core loader, it lists the files in your ComfyUI input directory in a dropdown (image_name), and it supports dragging in or uploading a new file. Run it and you get:

    • image - the loaded IMAGE.
    • mask - the alpha channel as a mask, when the file has one. Transparent PNGs come through as masks you can use for compositing or inpainting without a separate mask-extraction step.
    • width / height - the dimensions, as plain INTs. Wire these into an Empty Latent or a resize node and your workflow can adapt to whatever image you loaded instead of assuming a size.
    • metadata - the embedded metadata string. If the image came from A1111 or Civitai, this carries the original prompt and settings - genuinely handy for reverse-engineering or for passing provenance into Sage's metadata nodes.

    Two implementation details worth knowing: the file list is cached for a few seconds so the node doesn't rescan the input directory on every call (which would slow down big graphs), and it validates that the file actually exists before running, returning a clean "invalid image file" message if you've pointed it at something missing.

    Wiring it up

    The classic setup: load a reference image, feed width/height into an Empty Latent or into a resolution helper like the pack's Guess Resolution By Ratio to normalize for generation, and pipe image into an img2img or ControlNet branch. If the file has a workflow embedded in it, metadata is where you'd pull it from for display or re-embedding.

    Installing

    Part of Sage Utils:

    cd ComfyUI/custom_nodes
    git clone https://github.com/arcum42/ComfyUI_SageUtils.git
    cd ComfyUI_SageUtils && pip install -r requirements.txt
    

    Restart ComfyUI, or install "Sage Utils" via ComfyUI Manager. No models needed - it's a pure utility.

    Where people get tripped up

    The mask output is the alpha channel, not a separately-authored mask file. If your image has no transparency, that output is effectively empty - don't go looking for a mask that was never there. Also, the dropdown lists files in the input directory at graph load, so if you drop a new file into input while ComfyUI is running, it may not appear until you reload the node or refresh. And metadata is a raw string - for A1111/Civitai images it's usually a parameters JSON or plaintext block, which is readable but not parsed. That's what the pack's dedicated metadata nodes are for; this output just gets you the raw text.

    CategorySage Utils/image/file

    Inputs (1)

    NameTypeDefaultDescription
    image_nameCOMBOexample.pngThe file path of the image to load.

    Outputs (5)

    NameTypeDescription
    imageIMAGEThe loaded image.
    maskIMAGEThe alpha or mask output for the loaded image, if available.
    widthINTThe width of the loaded image.
    heightINTThe height of the loaded image.
    metadataSTRINGMetadata extracted from the loaded image.