Nodes/Rikannodes/Rikan Hidden Base64 Image Loader
ComfyUI Node

Rikan Hidden Base64 Image Loader

Decode a base64 string to pixels

By rikanrino·Created 4 months ago·Updated 4 months ago· 1
Rikan Hidden Base64 Image Loader
    • image
    • raw_base64
    base64_data

    If you've ever wanted to paste an image into a workflow the way you'd paste text into a textbox, this is the node. Give it a base64 string and it hands you a real IMAGE tensor that anything downstream - KSampler, img2img, IP-Adapter, a LoRA trainer - will happily eat. The "hidden" in the name is the whole point: the image data rides inside the workflow file itself, not in a file on disk that might get lost, renamed, or forgotten when you share the workflow.

    Core ComfyUI has no base64-to-image node, which is a genuine gap if you're doing any of this: exchanging workflows as a single text blob over Discord or chat, feeding a remote API result straight into the graph, or stashing a reference image inside a workflow JSON so it round-trips anywhere. That last one is the killer use case. You drag the workflow file to a friend, they open it, and the reference image is already there - no "where's that PNG I was supposed to download" moment.

    How it works

    The mechanism is boring in the best way. The node takes your base64_data string, strips a data:image/png;base64, header if you pasted one whole, base64-decodes the bytes, opens them with PIL, and converts to a [1, H, W, 3] RGB tensor in the 0–1 range ComfyUI expects. It returns that image plus raw_base64, the cleaned-up string without the header, if you want to pass the data along.

    One input to set: base64_data, a multiline string. Two outputs: image and raw_base64. That's the whole surface.

    The bundled UI is where it gets friendlier than the bare schema suggests. There's an Upload Image (Local Blob) button that reads a file off your disk, converts it to base64, and fills the widget for you, so you never have to hand-encode anything. And a View Decoded Image popup so you can sanity-check what's about to go into your pipeline before you wire it to a sampler.

    Where people get burned

    • Size. Base64 is roughly 33% fatter than the original binary. A 1MB PNG becomes ~1.4MB of text sitting in the widget, and ComfyUI saves workflow JSON with it. Keep reference images small - for a starter frame or a style reference you rarely need more than a few hundred KB.
    • It's one image, not a batch. This decodes a single frame. Feed it a video or a big batch and you're only getting the first decode's worth of pixels.
    • Failure is silent-ish. If the string is garbage, the node returns a 64x64 black tensor instead of throwing, which will not be obvious if it's sitting inside a big graph. The console prints the actual error.

    Installing

    It ships in the Rikannodes pack. Easiest path is ComfyUI Manager - search "Rikannodes" and install. Or the manual route:

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

    Then restart ComfyUI and you'll find the node under the Rikannodes category. The pack's only declared dependency is word2number, and it uses ComfyUI's newer extension API, so keep ComfyUI updated or the nodes won't register. The README is just a node list - this is a young, small pack, so if you hit something weird, the source in nodes.py is short enough to read.

    CategoryRikannodes

    Inputs (1)

    NameTypeDefaultDescription
    base64_dataSTRING

    Outputs (2)

    NameTypeDescription
    imageIMAGE
    raw_base64STRING