ComfyUI Node

UrlsToImage

The tiny URL-to-tensor loader hiding in the Gelbooru pack

By 1mckw·Created 2 years ago·Updated 2 months ago· 11
UrlsToImage
    • images
    urls

    A node with a single text input that downloads images from URLs and turns them into a tensor - that's the whole pitch, and it's easy to overlook because it ships in a booru pack. Don't. UrlsToImage is the glue that makes the other two nodes in Comfyui-Gelbooru useful: Gelbooru (Random) and Gelbooru (ID) hand you image URLs in their imgurl output, but a URL isn't pixels. This node does the download. It also stands perfectly well on its own as a general "load an image from the internet" helper.

    It was clearly written to cover the pack's own bases, so it supports a wider range of sources than you'd expect: plain http:// and https:// URLs, data:image/ base64 blobs, and s3:// paths. No API key, no account, nothing to configure - paste, run.

    How it works

    Paste one URL per line into the urls box. On execution the node splits on newlines, downloads each one, and stacks them into a single batched IMAGE tensor. That stacking is where the one real quirk lives: images of different resolutions get upscaled with bilinear resampling to match the first image's size so they can be concatenated along the batch dimension. So ordering matters - put the resolution you want to keep first, and don't expect your 1024px reference to survive being squashed to fit a 512px first entry.

    For http(s) it's a plain requests GET with a timeout, and a non-200 status raises an error - you'll see it in the console. It applies EXIF transposition (so phone photos don't come in sideways) and composites any alpha onto black, which is a reasonable default for feeding into img2img.

    What you actually set

    Just the one input: urls, multiline, one URL per line. That's it. The output images is a standard IMAGE tensor, so it plugs into VAE Encode for img2img, an image comparison node, a ControlNet preprocessor, or anything else that takes an image.

    Install

    Same as the rest of the pack - ComfyUI Manager (search "Comfyui-Gelbooru") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/1mckw/Comfyui-Gelbooru.git
    python_embeded\python.exe -m pip install -r custom_nodes\Comfyui-Gelbooru\requirements.txt
    

    then restart. The requirements are requests and boto3; boto3 only actually matters if you plan to load from s3:// (it's in the list regardless). No model files, nothing heavy.

    Gotchas

    Three things bite people. First, a trailing blank line in the urls box: the node splits on newlines, so an empty last line becomes a URL of "", and requests raises a MissingSchema error. End clean. Second, s3:// URLs require valid AWS credentials in your environment - it's boto3.client('s3') with no special handling, so it uses whatever's configured on the machine. Third, mismatched image sizes get silently resized to the first image's dimensions; if your batch looks stretched, reorder your URLs. For the pack's own purpose - feeding imgurl from the Random or ID node into your workflow - it just works.

    CategoryGelbooru

    Inputs (1)

    NameTypeDefaultDescription
    urlsSTRINGImage URLs to load, one per line (supports http://, data:image/, s3://)

    Outputs (1)

    NameTypeDescription
    imagesIMAGELoaded image tensor(s) from the provided URLs