Nodes/ComfyUI_Dados_Nodes/Base64 to Image
ComfyUI Node

Base64 to Image

The plumbing node that turns base64 back into pixels

By DadoIrie·Created 2 years ago·Updated a day ago· 10
Base64 to Image
    • image
    base64_string

    Base64 to Image is the reverse half of an image-transport pair, and it exists for one reason: a lot of the world hands you images as giant text strings, and ComfyUI wants tensors. Any API that returns an image in a JSON blob - a vision model's output, a custom HTTP endpoint, a script that dumped your last render to a text file - is going to hand you base64. This node takes that string and converts it back into a proper IMAGE tensor that the rest of your graph can process, preview, or save.

    It's a boring utility, and that's the compliment. When you need it, you really need it, and there's nothing clever to trip you up.

    How it works

    The mechanism is straightforward and worth knowing because it explains the two input formats it tolerates:

    • It strips a data:image/... prefix if present, so a full data-URI works as-is.
    • It splits on commas. That means one base64 string becomes one image, but comma-separated base64 strings become a batch - handy if you're feeding it the concatenated output of several sources.
    • Each chunk is decoded, opened with PIL, converted to RGB, and normalized to the 0–1 float range ComfyUI expects.
    • Multiple images are concatenated along the batch dimension.

    So the same input field handles "here's one PNG" and "here's ten PNGs, go." That's most of what you need to know.

    The input that matters

    Only one input exists: base64_string. There's no options menu, no knobs. If your string starts with data:image, it's handled. If it's raw base64, it's handled. Either way the single output is image (IMAGE), ready to wire into anything that takes an image tensor - a preview, an img2img sampler, or another node's input.

    Install

    Part of the Dados Nodes pack, so the usual two routes: ComfyUI Manager → search "Dados Nodes", or

    cd ComfyUI/custom_nodes
    git clone https://github.com/dadoirie/ComfyUI_Dados_Nodes.git
    cd ComfyUI_Dados_Nodes
    pip install -r requirements.txt
    

    then restart. No models to download, no API keys, no special dependencies for this specific node - it's pure stdlib (base64, PIL, numpy).

    Common issues

    The errors here are self-explanatory because the node raises them for you. The one to watch: a string that isn't valid base64 throws a clear "Failed to decode or process base64 image" error - usually a copy-paste that got truncated or had a stray newline. The node doesn't sanitize whitespace, so paste carefully. And if you feed it an empty or None string it errors immediately rather than silently passing through. If you're building a workflow that round-trips images (this node + the pack's Image to Base64), keep them wired through a plain text line rather than the console, because long base64 blobs in the ComfyUI value box are a paste-timestamping nightmare waiting to happen.

    That's the whole thing. It's a pair of brackets in your workflow - small, invisible, and doing exactly one job well.

    CategoryDado's Nodes/Image

    Inputs (1)

    NameTypeDefaultDescription
    base64_stringSTRING

    Outputs (1)

    NameTypeDescription
    imageIMAGE