Base64 To Image
Decode base64 straight into an IMAGE batch
- IMAGE
- MASK
Base64ToImage is the reverse of this pack's ImageToBase64: you give it one or more base64-encoded image strings, it decodes them, and you get back a genuine ComfyUI IMAGE (and a MASK) you can feed straight into the rest of your graph. This is how you get images into a workflow when your caller doesn't have a file sitting in ComfyUI's input/ folder to point at - which, if you're calling ComfyUI as an API rather than uploading through the browser, is the normal situation, not an edge case.
It's part of comfyui-easyapi-nodes, lldacing's pack for API-driven ComfyUI work, and it's directly tied to one of the pack's more convenient features: the extended "Save (Api Format)" menu it adds includes a "Copy EasyApi as" option that automatically rewrites a workflow's LoadImage nodes into Base64ToImage nodes (and PreviewImage/SaveImage into ImageToBase64) when you export it for API use. So instead of manually swapping nodes every time you want an API-ready copy of a workflow you built visually, the pack does that substitution for you in one click.
How it works
The input takes a JSON-formatted array of base64 strings - the default value, literally ["" ], is a hint at the expected shape: a list, even if it's just one element. It decodes each entry and returns them as a proper IMAGE batch, along with a MASK batch derived the same way ComfyUI derives masks from image alpha elsewhere.
The inputs and outputs that matter
base64Images(STRING, multiline, default["" ], required) - the base64-encoded image(s), formatted as a JSON array of strings. This is a text field, not a file picker - you're expected to paste or programmatically inject the base64 payload here.- Output:
IMAGE- the decoded image batch (list output). - Output:
MASK- the corresponding mask batch (list output).
How to install it
Through ComfyUI Manager, searching comfyui-easyapi-nodes. Manual install:
cd ComfyUI/custom_nodes
git clone https://github.com/lldacing/comfyui-easyapi-nodes.git
cd comfyui-easyapi-nodes
pip install -r requirements.txt
Restart ComfyUI. No model downloads - decoding is plain CPU work.
Common issues & troubleshooting
Node errors on the input, or decodes garbage. The field expects a JSON array of base64 strings, not a bare base64 string on its own. A single image still needs to be wrapped as a one-element array - ["<base64 data>"] - matching the default placeholder's shape. Passing a raw unwrapped string is the most likely reason this fails.
Where does the base64 string actually come from? Usually your own API client - you read an image file, base64-encode it in whatever language you're calling from, and inject the resulting string into this field when you submit the prompt via ComfyUI's API. If you're testing manually first, ImageToBase64 elsewhere in the same pack is a quick way to generate a valid base64 string from an existing image to paste in here.
UI gets sluggish with this node in the graph. Same base64-length tradeoff the pack's README calls out for the encode side - long strings sitting in a multiline widget can bog down the canvas, especially with large images. If you're hitting this regularly in production, the README's own recommendation is object storage plus a URL-based loader instead of base64 round-trips.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| base64Images | STRING | [""] | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |