Nodes/PixelML ComfyUI Nodes/LoadImageFromURL_PixelML
ComfyUI Node

LoadImageFromURL_PixelML

Paste a URL, get an image and a mask — without staging files into your input folder

By PixelML·Created 2 years ago·Updated 2 years ago· 0
LoadImageFromURL_PixelML
    • IMAGE
    • MASK
    urlhttps://raw.githubusercontent.com/comfyanonymous/ComfyUI/master/input/example.png
    return_image_modeRGB

    LoadImageFromURL_PixelML is the node you reach for when the reference image you need is on the internet and you'd rather not babysit a download into ComfyUI/input/. Paste a URL into the url field, run the graph, and it fetches the image into a temp file, loads it, and hands you a proper IMAGE tensor plus a MASK - ready to wire into a VAE Encode, a ControlNet preprocessor, or anything else that eats images.

    It's part of the PixelML ComfyUI Nodes pack, and it's the one node in the pack that does actual file I/O. The rest of the pack fusses over variables and types; this one gets its hands dirty with HTTP.

    How it works

    The flow, straight from the source:

    1. Download. The URL is fetched to a temporary file via a requests-based helper, streamed in chunks with a progress bar. Auth headers aren't sent, so private or token-gated URLs will fail - it's for public images.
    2. Open and normalize. PIL opens the file, applies EXIF transposition (so camera photos aren't sideways), and converts to your chosen color mode.
    3. Frame handling. Multi-frame images (animated GIFs, multi-page files) are iterated into a batch - every frame becomes a row in the output tensor. One frame, one image.
    4. Tensor + mask. The image becomes a float32 tensor scaled to 0–1. If the source has an alpha channel, the MASK output is 1 - alpha - meaning fully transparent pixels are mask value 1, exactly like core ComfyUI's LoadImage. No alpha channel means an empty 64×64 mask.

    Two real-world quirks to expect. First, it re-downloads on every run - there's no cache, so repeated runs against a big image burn bandwidth and add seconds each time. Second, the node prints debug lines like Old image mode: RGB to your console on every load; harmless, but it will clutter the log if you run it often.

    The inputs that matter

    • url (STRING) - the direct image URL. Defaults to ComfyUI's example.png on GitHub. HTTPS works; hotlinked preview URLs from Civitai or similar generally do too, as long as they don't require a token.
    • return_image_mode (enum, default "RGB") - the color mode of the output: RGB, RGBA, BGR, BGRA, L (grayscale), or 1 (1-bit). The interesting ones are BGR/BGRA - PIL has no native BGR, so the node swaps channels itself. Reach for those if downstream code expects OpenCV-style channel order.

    The outputs

    • IMAGE - the batch tensor, shape (frames, height, width, channels), values 0–1.
    • MASK - the alpha-derived mask, 1 - alpha, or a blank 64×64 mask when there's no transparency.

    Install

    Search "PixelML ComfyUI Nodes" in ComfyUI Manager, install, restart - or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/PixelML/ComfyUI-PixelML-CustomNodes
    

    Then restart. The pack's requirements.txt pins diffusers==0.24.0 and lists boto3/httpx/httpx-sse, but this node only needs PIL, numpy, torch, and requests - all ComfyUI staples. If the pinned diffusers downgrade breaks other nodes in your setup, skip the requirements file; the URL loader doesn't use it.

    Where people get burned: a URL that 404s or redirects to a login page fails the run, a giant image makes every run slow thanks to the no-cache download, and gated-host links just won't load. Keep it to public, direct image URLs and it behaves. If you need offline repeatability, the file's already on disk - save it once and use the core LoadImage instead.

    Categoryimage

    Inputs (2)

    NameTypeDefaultDescription
    urlSTRINGhttps://raw.githubusercontent.com/comfyanonymous/ComfyUI/master/input/example.png
    return_image_modeoptCOMBORGB6 options: RGB, RGBA, BGR, BGRA, L, 1

    Outputs (2)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK