Image To Base64
Turn an image into a base64 string
- image
- STRING
Every image in a ComfyUI graph is a tensor - great for nodes talking to each other, useless the moment you need to hand that image to something outside the graph as plain text. easy imageToBase64 bridges that gap: feed it an image, get back a string you can drop into a webhook payload, an API response, or anywhere else that wants a portable, text-safe representation of a picture instead of a file.
Why you'd reach for it
This is a node for graphs that talk to the outside world, not for a normal generate-and-save workflow. If you're calling ComfyUI's API programmatically and want the result handed back inline in the JSON response instead of as a file path you then have to fetch separately, base64-encoding the image inside the workflow itself means the caller gets the picture directly in the response body. It's also the shape a lot of downstream integrations expect by default - plenty of chat/LLM APIs, browser previews, and no-file-access sandboxes want an image as a base64 string rather than a filesystem path.
If your workflow already saves to disk and that's all you need, skip this node entirely - it exists specifically for the "the image needs to leave ComfyUI as text" case, which is a minority of workflows but a real one.
How it works
It encodes the image tensor into image bytes and then base64-encodes those bytes into a string, the same conceptual operation as running an image through base64.b64encode() after saving it - except it happens in-graph, without writing a file to disk first.
The inputs and outputs that matter
image- the image to encode. The only input.STRING(output) - the base64-encoded result. Wire it into whatever downstream node or API-response step needs a string instead of an image.
That's the entire node - no format or quality settings exposed, so you're at whatever the node's default encoding is.
Installing it
Ships with the base pack, no separate install. ComfyUI Manager: search ComfyUI Easy Use, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/yolain/ComfyUI-Easy-Use
then install.bat on Windows or pip install -r requirements.txt, restart. No models.
Common issues & troubleshooting
The string is huge. Base64 encoding inflates data size by roughly a third over the raw image bytes, and a full-resolution PNG or high-quality image is already large before that inflation. If you're piping this into something with a payload size limit (a webhook, a chat API, a browser's URL length limit if you're building a data URI), downscale the image first with a resize node before encoding, or reconsider whether you actually need base64 at all versus just returning a file path.
Downstream expects a data URI, not raw base64. A raw base64 string (what this node gives you) and a data URI (data:image/png;base64,...) aren't the same thing - some consumers, especially anything rendering the string directly as an <img src>, need the data:image/...;base64, prefix added. If your image "isn't displaying" on the receiving end but the string itself looks correct, check whether the consumer needs that prefix and prepend it (an easy stringConcat-style node, or handling it on the receiving side) rather than assuming the encoding itself is broken.
Using this for every image "just in case." Base64-encoding is real CPU work, and it happens on every run through this node. If you're batch-processing a lot of images and only occasionally need one handed off as a string, put this node on the specific path that needs it rather than routing your whole batch through it by default.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |