Nodes/ComfyUI_Lam/加载网络图片或本地图片
ComfyUI Node

加载网络图片或本地图片

Load an image from an absolute path or a URL — not just the input folder

By yanlang0123·Created 2 years ago·Updated 11 days ago· 77
加载网络图片或本地图片
    • image
    • mask
    • filename_text
    image_path./ComfyUI/input/example.png
    RGBA
    filename_text_extension

    ComfyUI's built-in Load Image only shows files inside input/. The moment your image lives anywhere else - another drive, a network share, an http URL - you're stuck. LamLoadPathImage (加载网络图片或本地图片, "load a network or local image") is the escape hatch: give it a real path or a URL and it hands you a proper IMAGE, a MASK, and the filename as a string.

    The use cases are obvious once you've hit them: feeding screenshots from a folder your other tools write to, loading a reference image straight off the web without a download dance, or keeping images in a shared location across machines. It's the kind of node you don't think about until you need it, then you need it constantly.

    How it works

    Path starting with http? It fetches it with requests and opens it. Otherwise it tries the path as-is, and falls back to ComfyUI's input/ directory resolution. Two details worth knowing: if the file genuinely doesn't exist, it doesn't crash - it returns a black 512×512 placeholder and prints a warning. And IS_CHANGED is set to always-true, meaning the node re-reads the file on every execution, so it picks up changes to the same path between runs. That's handy for monitoring a folder, though it means the node "never caches."

    Inputs

    • image_path - the path or URL. Default is ./ComfyUI/input/example.png.
    • RGBA - false (default) forces RGB and discards any alpha; true keeps RGBA through to the IMAGE output.
    • filename_text_extension (optional) - true gives you photo.png, false gives photo. Just controls what the filename_text output contains.

    Outputs

    • image (IMAGE) - ready for any sampler or image-processing node.
    • mask (MASK) - the alpha channel as a mask if the source has one; a blank 64×64 mask otherwise.
    • filename_text (STRING) - the base filename, handy for feeding into file-prefix or metadata nodes downstream.

    Install

    Part of the ComfyUI_Lam pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yanlang0123/ComfyUI_Lam
    

    or via ComfyUI Manager, then the README's install + 修改文件 steps. No models, no server, no extra downloads for this one - just the pack.

    Gotchas

    The black-placeholder behavior for missing files is double-edged: it keeps workflows alive but silently feeds a black image into your pipeline, which can ruin a run invisibly. If results come out unexpectedly black, check you didn't typo the path. For URLs, it needs network access from the ComfyUI machine and follows redirects fine, but an unreachable host just logs the error and (per the fallback) gives you a placeholder too. RGBA=false discards transparency - flip it on if you're loading PNGs with alpha and care about the mask.

    Categorylam

    Inputs (3)

    NameTypeDefaultDescription
    image_pathSTRING./ComfyUI/input/example.png
    RGBACOMBO2 options: false, true
    filename_text_extensionoptCOMBO2 options: true, false

    Outputs (3)

    NameTypeDescription
    imageIMAGE
    maskMASK
    filename_textSTRING