Convert Image To Base64
When your ComfyUI output needs to ride in a JSON response, not a folder
- images
Most of the time, a generated image's final stop is a file in ComfyUI/output. But if you're building an app on top of ComfyUI - a custom API, a Discord bot, an Open WebUI-style frontend, a serverless worker - your consumer doesn't want a file path. It wants the image itself, inline, in the JSON it already got back. JSON can't carry raw binary, so the standard trick is base64: the image bytes, text-encoded. That's exactly what this node does. Wire any image in, and the base64 string shows up in the workflow's execution result instead of in a folder.
This is a deliberate design, not a missing feature. The node is an output node - in ComfyUI's API parlance, that means it has no tensor outputs, so nothing travels over the wires downstream. Instead, when the workflow finishes, the strings land in the ui payload of the result. If you're driving ComfyUI through the /prompt + /history API, you read them from outputs[<node_id>]["images"][i]["base64"]. In the web UI you can see the same thing in the browser console. It's the same handshake pattern the big serverless wrappers use - the RunPod ComfyUI worker, for instance, grabs the output list from the API response and re-encodes those files to base64 on the way out. This node just cuts out the middleman: it's base64 before anything touches disk.
Under the hood it's small and boring in the good way. For each image in the batch it clamps the tensor to 0–255, converts to uint8, PIL-encodes it to PNG into a memory buffer, and base64-encodes that. The one input that matters is images (IMAGE), which is all there is. Feed it a batch of four and you get four separate base64 strings, in order - each entry in the result list corresponds to one frame, so keep that mapping in mind if you're decoding on the other side. The format is hardcoded PNG, no choices to make, no alpha channel (IMAGE tensors are RGB).
Install
It's a two-node pack with one line of README, released December 2025, and it's barely on the map - a single star and no community footprint at the time of writing. It works, but set your expectations: this is a purpose-built utility by Asidert, mostly yoinked from two older packs, not an actively maintained ecosystem staple.
- ComfyUI Manager → search ComfyUI_Base64Images (or "Base64 Images") → Install → Restart.
- Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Asidert/ComfyUI_Base64Images
Then restart ComfyUI. There's no requirements.txt and no declared dependencies - it leans on the torch, numpy, PIL, and opencv that ship in ComfyUI's own environment, so nothing extra to pip install.
Where people get burned
- You can't wire the output anywhere. It's an output node with no tensor return, so a beginner looking for a "save this base64 to a text file" path will stare at an empty output socket. The data goes to the API result, full stop.
- Base64 is heavy. Encoding adds ~33% on top of the PNG, and a 1024×1024 PNG can already be a couple of megabytes. The recurring advice in the community for anything real is: return URLs (S3, or a static folder) instead of inline base64, or your API responses will outgrow whatever's parsing them. This node is great for small, quick payloads and genuinely wrong for a high-volume production pipe.
- The whole module imports
cv2at load time, even though this node never uses it - the siblingLoadImageFromBase64does. In a normal install that's fine because ComfyUI bundles OpenCV. In a stripped-down serverless Docker image where you've trimmed packages, the node won't even register. Worth remembering if you're slimming images down.
It's a niche tool, but when you need it, it's the exact right shape: image in, base64 string in your API response, no files, no glue code on the server.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — |
Outputs (0)
No outputs