Rikan Hidden Base64 Image Saver
Turn pixels into a string you can copy
- image
- base64_data
This is the sibling of the Rikan Hidden Base64 Image Loader: pixels in, a base64 string out. Where the loader lets you paste an image into a workflow, this one lets you pull a result out of the graph as text - a PNG encoded into a single string you can copy, save, or ship to whatever script or API is waiting on the other side.
Why bother, when ComfyUI already has a Save Image node? Because that node writes a file, and a file needs a path, a folder, and a human to go fetch it. The Saver turns the output into data you can embed anywhere: paste it into a chat, throw it at a custom API endpoint, stash it in a database, or store it in the workflow metadata so the pipeline's result travels with the JSON. If you're building automation around ComfyUI - a bot, a queue, a service - having the image as a string in the response is often exactly what you want.
How it works
The node takes your image, grabs the first frame of the batch, converts it to a PIL image, and encodes it as PNG entirely in memory (no temp file, no disk write) into a base64 string. That string comes out both as a base64_data output you can wire into anything that wants text, and into the node's UI via the base64_data UI value.
Inputs: just image. Output: base64_data (a STRING). It's marked as an output node, so ComfyUI treats it as a terminal - it runs even without a cable hanging off the end.
The UI does the heavy lifting for the common case. A 📋 Copy Base64 button drops the latest result straight onto your clipboard, and a 🔍 View Decoded Image popup shows the picture with a read-only textarea containing the data, so you can eyeball what you just encoded before you paste it somewhere. After you run, the popup's "Close & Clear Memory" button releases the held image.
The honest caveats
- One frame only. It encodes
image[0]. If you're generating video, this captures a single frame - run it per-frame if you genuinely need the whole clip as base64, and expect a very large string. - PNG is big. Base64 of a PNG of a busy image can run to multiple megabytes of text. Fine for a still you're embedding once; unwieldy if you're doing it in a tight loop.
- It's the mirror image of the loader. Encode with this, decode with the Loader, and the round trip works - same pack, same format, and both tolerate the data-URL header dance.
Installing
Same pack as the Loader, so the steps are identical:
cd ComfyUI/custom_nodes
git clone https://github.com/rikanrino/Rikannodes
pip install -r Rikannodes/requirements.txt
or ComfyUI Manager → search "Rikannodes" → install, then restart. Nodes land under the Rikannodes category. The pack is small and young (README is just a node list), its only declared dependency is word2number, and it needs a current ComfyUI because it uses the newer extension API. Realistically: if you don't need your output as text, use Save Image. If you do, this is the one you'll reach for.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| base64_data | STRING | — |