ComfyUI Node

Base64 URL to Image Node

Turn a base64 data URI into an IMAGE tensor

By AhBumm·Created 2 years ago·Updated 3 months ago· 11
Base64 URL to Image Node
    • IMAGE
    base64_url

    The name is a lie. "Base64 URL to Image" doesn't take a URL at all - it takes a base64 data URI: one of those data:image/png;base64,.... strings that image APIs love to hand back instead of a file. If you're here, it's almost certainly because an API node in this very pack (or any image-generation endpoint) returned a base64 blob and you need it as an actual IMAGE you can preview, save, or push into an img2img node. That's this node's one job, and it does it in about ten lines.

    It's the natural flip side of the pack's "Image to Base64 URL" node: that one encodes a tensor up, this one decodes it back down. Together they round-trip images into text-space and home again, which is the whole trick of passing images to text-based APIs.

    How it works

    The mechanism is tiny and worth knowing because it explains the one way this breaks:

    base64_data = base64_url.split(",")[1]
    image_data = base64.b64decode(base64_data)
    image = Image.open(io.BytesIO(image_data))
    

    It splits the string on the comma, throws away everything before it (the data:image/png;base64, prefix), decodes the rest, opens it with Pillow, and converts it to the usual float tensor with a batch dimension. Zero network calls, zero API keys - this node is pure local string-to-tensor plumbing.

    Inputs and outputs

    • base64_url (STRING) - the full data URI, prefix and all. Because of that split(",")[1], the comma matters: paste a bare base64 blob without the data:...;base64, header and you get an IndexError, not a graceful warning.
    • IMAGE - one output, the decoded image ready to wire into any node that expects an IMAGE.

    Installing it

    It ships with AhBumm/ComfyUI_BillBum_Nodes. Easiest via ComfyUI Manager (search "billbum"), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AhBumm/ComfyUI_BillBum_APIset_Nodes.git
    cd ComfyUI_BillBum_APIset_Nodes && pip install -r requirements.txt
    

    Restart ComfyUI afterward. Dependencies are the pack's usual light set - requests, pillow, numpy, the OpenAI client - nothing heavy, no model downloads.

    Where people get burned

    • Bare base64, no prefix. The single most common failure. The node expects the full data:image/...;base64,<data> string. If your source gives you raw base64, prepend data:image/png;base64, yourself, or use the pack's url2image node instead - it's more forgiving and also accepts data URIs.
    • It decodes one image per run. It's not a list node; batch this yourself if you need to decode several at once.

    Honestly, this is a "have it on the shelf" node more than a headline feature. You'll use it exactly when a workflow's API returns base64, and then you'll use it a lot. If that's not your workflow, you can skip the pack entirely and never miss it.

    CategoryBillBum Image Processing

    Inputs (1)

    NameTypeDefaultDescription
    base64_urlSTRING

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE