Nodes/ComfyUI-ADIC/从URL列表加载图片
ComfyUI Node

从URL列表加载图片

Point it at a URL list, get IMAGE tensors back

By jinchanz·Created about a year ago·Updated a day ago· 5
从URL列表加载图片
    • images
    • loaded_urls
    • count
    urls
    input_formatauto
    max_images10
    timeout30

    ComfyUI's built-in loader reads from disk. The moment your images live on a URL - a translation service's output, an OSS bucket, a CDN - you need something that downloads them mid-graph. That's this node: paste or wire a list of URLs, and it fetches each one into a proper IMAGE tensor your downstream nodes can use.

    The mechanism is a plain HTTP fetch loop with a browser-ish User-Agent. It parses your urls input - which can be a JSON array (["a.jpg","b.jpg"]) or newline-separated lines; the input_format of auto tries JSON first and falls back to newlines. Each URL must be valid http(s) (it validates), must return a content-type starting with image/ (a PDF link gets skipped, not error), and gets a per-URL timeout. Loaded bytes are decoded with PIL, converted to RGB, and stacked into a batch.

    Inputs and outputs that matter

    • urls - required, multiline. The list to fetch.
    • max_images - cap on how many to load, default 10 (1–50). Handy when a source gives you more than you want.
    • timeout - per-request seconds, default 30 (5–300).
    • input_format - auto / json_array / newline_separated.

    Outputs:

    • images - the downloaded images as a list of IMAGE.
    • loaded_urls - JSON array of the URLs that actually succeeded. This is your audit trail, because...
    • count - how many made it through. Watch this: failures are skipped, not fatal, so count is how you know the batch was thin.

    The trap: silent placeholders

    If nothing loads, this node does not raise - it returns a 64x64 black placeholder tensor and count = 0. In a big workflow that looks exactly like "the load succeeded but produced nothing." The console log is where the truth lives: every skip logs a reason (跳过非图片内容, download failures, invalid URLs). When a workflow comes back empty after this node, read the log before touching anything else.

    Where it fits

    This is the natural partner to the pack's API nodes. The translate flow ends with ImageTranslateResultExtractor handing you result_urls; those feed this node's urls input (it auto-detects the JSON array), and you're back to local tensors for preview/save. Same story for the signed public_urls out of AliCloudOSSUpload - though note those expire after an hour, so load them while they're fresh.

    Installing

    cd ComfyUI/custom_nodes
    git clone https://github.com/jinchanz/ComfyUI-ADIC
    

    Restart ComfyUI, or use ComfyUI Manager → "ComfyUI-ADIC". Needs only requests (already present). No models, no downloads beyond the images you point it at.

    CategoryMalette

    Inputs (4)

    NameTypeDefaultDescription
    urlsSTRING
    input_formatoptCOMBOauto3 options: json_array, newline_separated, auto
    max_imagesoptINT101–50
    timeoutoptINT305–300

    Outputs (3)

    NameTypeDescription
    imagesIMAGE
    loaded_urlsSTRING
    countINT