Base64 to Image
Paste a Base64 image into your workflow — no temp file, no upload, no fuss
- image
LLMs and "agents" hand images around as Base64 strings, not files. If you're wiring Claude, GPT, or your own Python script to ComfyUI - a genuinely popular pattern lately, there are whole projects built around LLMs triggering ComfyUI workflows - you've hit the annoying part: an image arrives as a giant wall of text, and you have to save it to disk, Load Image, then clean up the file. Base64Decode skips all of it. Paste the string in, get an IMAGE tensor out. The name is the whole job description: this is a decoder, not a tool that calls some API or needs a key.
It comes from a tiny pack called comfyui-agent-adapter, which is basically three nodes for the "agent talks to ComfyUI" plumbing: decode Base64 in, encode Base64 out, and an aspect-ratio calculator. The pitch in the README is that nothing touches the filesystem server-side. For an automation pipeline that runs unattended, that's not a convenience - it's the difference between a script that accumulates junk files and one that doesn't.
How it works
The mechanism is unglamorous and reliable. The node takes your string, strips any data: URI prefix (anything up to the first comma, so both data:image/png;base64,iVBOR... and raw Base64 work), base64-decodes it, loads the bytes as a PIL image, converts to RGB, normalizes to 0–1 floats, and returns it as a [1, H, W, C] tensor. That's exactly what the rest of ComfyUI expects, so it plugs into anything that takes an IMAGE: VAE Encode, a preview, img2img, an IP-Adapter reference, ControlNet conditioning - wherever you'd normally wire a Load Image.
It also implements IS_CHANGED on the string itself, which means ComfyUI re-runs it when the string changes and correctly caches it when it doesn't. Small thing, but it's the difference between "every rerun is fast" and "the graph recomputes for no reason."
Inputs and outputs that matter
There's one input, base64_string (a multiline STRING, so pasting works), and one output, image. That's the whole node. Don't overthink it.
Common issues
- Transparency gets flattened. The decoder converts RGBA (and palette/LA modes) to RGB, which silently drops the alpha channel. If your incoming image has meaningful transparency and you need a mask, keep a PNG-with-alpha path in mind - this node won't give you the alpha back.
- "Base64 string is empty" if you feed it a blank string - it raises rather than returning garbage, which is honestly the right call for automation.
- It's one image per call. No batch support. Fine for agent round-trips, wrong tool for decoding a folder.
- Pasting a huge string in the UI is miserable (the widget reflows, selection fights you). This node really shines when something else feeds it programmatically - an agent, a webhook, your own
requestsscript hitting/prompt.
If you're just trying to get one image into a workflow on your own machine, Load Image with drag-and-drop is easier and you know it. Reach for this when the image is coming from software that speaks Base64 - that's the whole point.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/yaofeng/comfyui-agent-adapter
cd comfyui-agent-adapter
pip install -r requirements.txt
Then restart ComfyUI. Or just search the pack in ComfyUI Manager - it's the easy route and the one I'd take. Good news on dependencies: it only needs Pillow, torch, and numpy, all of which stock ComfyUI already has. No model downloads, no heavy wheels. Note the README's clone URL still says your-username - the author copy-pasted the template and never fixed it. It's harmless; the real repo is yaofeng/comfyui-agent-adapter.
One honest caveat: this pack is brand new, one commit, essentially zero community footprint. The code is simple and works, but don't expect a bug tracker full of answers. That's fine for a node this small - just know what you're getting.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| base64_string | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |