Nodes/ComfyUI-load-image-from-url-xy/LoadImageFromUrlOrPathXY
ComfyUI Node

LoadImageFromUrlOrPathXY

Stop hand-downloading reference images — make the node fetch them

By rocing·Created 2 years ago·Updated 2 years ago· 2
LoadImageFromUrlOrPathXY
    • IMAGE
    • MASK
    url_or_path
    connect_timeout5
    read_timeout10

    ComfyUI's built-in LoadImage only reads files sitting in your input/ folder. That's fine for a workflow you run by hand, and a pain in the neck the moment your reference image lives somewhere else. LoadImageFromUrlOrPathXY is the variant that takes a URL - or a filesystem path - and does the fetching itself, retrying until it has the whole file. It hands you the exact same IMAGE + MASK pair the core node does, so you drop it in place of LoadImage and nothing downstream cares.

    The name is honest about what it does, which is refreshing: no API key, no model download, no cloud. It's a requests call wrapped in a node.

    How it works

    The whole pack is one node and one Python file, so the mechanism is easy to read. Give it a string that starts with http and it does a requests.get with two timeouts - a connect timeout and a read timeout - retries up to three times with a one-second pause between attempts, and then verifies the download actually completed by comparing the Content-Length header against the number of bytes it received. If the sizes don't match, it quietly retries.

    That size-check is the entire reason this node exists. The pack's README is a single line of Chinese: "added retry for image download." The author shipped this to fix half-downloaded images, and it does that job well.

    Give it anything that doesn't start with http and it treats the string as a local path and opens it straight through PIL. Note that's a raw filesystem path - you type C:\refs\base.png or /home/you/pics/base.png, not the dropdown file picker you get from core LoadImage.

    The conversion half is a straight copy of core LoadImage's pil2tensor: it transposes EXIF rotation, converts to RGB, and if the image has an alpha channel it derives the mask as 1 − alpha. No alpha means a 64×64 zero mask - which is exactly what core does, so don't panic when a JPEG comes out with a tiny dummy mask. Bonus: it iterates ImageSequence, so an animated GIF or multi-frame PNG becomes a proper batch of IMAGEs.

    The inputs that matter

    • url_or_path - the URL or local path. It's a multiline box, but one line is all you need.
    • connect_timeout (default 5) - how long to wait for the connection itself.
    • read_timeout (default 10) - how long to wait between chunks. If you're pulling from a slow server, this is the one to raise.

    Outputs are IMAGE and MASK. Wire IMAGE into anything that takes an image: img2img, a ControlNet preprocessor, an IPAdapter-style reference, a face-restore pass. MASK only has content if your source had an alpha channel, so mostly it just sits there.

    Installing it

    ComfyUI Manager → search ComfyUI-load-image-from-url-xy, install, restart. Or the manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/rocing/ComfyUI-load-image-from-url-xy
    

    Then restart ComfyUI. There's no requirements.txt and nothing heavy - it leans on requests, Pillow, and torch, which a stock ComfyUI already has. No models to hunt down.

    Where people get burned

    The one real gotcha is caching. This node implements no IS_CHANGED, so ComfyUI treats "same URL, same timeouts" as "same result" and won't re-download during a session. If the remote image changes and you want the new one, bump the URL (a ?v=2 query param works) or restart the backend. If you're building automation that watches a changing source, this can bite you.

    Also: the URL must be a direct image link. Hotlink-protected hosts and anything behind a login will 403, and retries can't fix that. And when a download does fail, the node prints a Chinese error and returns None - which then trips up whatever you wired the IMAGE into. The error message is clear, but it's a runtime crash, not a graceful skip.

    Honest verdict: it's a tiny single-purpose utility from a tiny pack, with basically no community footprint - nobody on Reddit is writing essays about it. But for the automation case - a workflow that pulls a reference from a URL each run - it's a genuinely handy five-minute install, and the retry logic is the difference between "sometimes the image comes back corrupt" and "it just works."

    Categoryimage

    Inputs (3)

    NameTypeDefaultDescription
    url_or_pathSTRING
    connect_timeoutINT5
    read_timeoutINT10

    Outputs (2)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK