ImageLoadFromBase64(IOHelpers)
Paste a base64 image straight into your workflow
- IMAGE
- MASK
Sometimes the image arrives as text. A web API returns it as base64. A colleague pastes a data URI into a chat. A script hands your workflow a string instead of a file. ImageLoadFromBase64(IOHelpers) decodes that string back into a real IMAGE inside the graph - no file, no disk, no intermediate save step.
It's the mirror image of the pack's ImageSaveAsBase64: one node turns your output into a base64 string, this one turns a base64 string back into pixels. Put them together and you have a complete image round-trip through whatever automation you're building - ComfyUI in, string out, string in, image out - without a single filename to manage. If you're wiring ComfyUI into a web backend, that pairing is genuinely handy.
How it works
The node takes your string, and if it starts with data:image/ it strips the data:image/png;base64,-style prefix. Then it base64-decodes, wraps the bytes in a BytesIO buffer, and opens it with PIL - same image path as the pack's file loader, minus the disk. It walks animation frames (a GIF in base64 comes through as a batch), applies exif_transpose, converts to RGB, and normalizes to the usual float tensor. It also derives a mask from the alpha channel, inverted to ComfyUI's white-keeps convention.
Inputs and outputs
- base64_string - the only input. Both forms work: a raw base64 blob, or a full
data:image/png;base64,...data URI (the prefix is detected and stripped automatically).
Outputs:
- IMAGE - the decoded image, ready for VAE Encode, img2img, whatever.
- MASK - alpha-derived mask when the source has transparency; empty 64×64 mask otherwise.
Installing it
This is one node in a single-file, dependency-free pack from GitHub user Ryuukeisyou - no requirements.txt, no models to fetch, nothing beyond what ComfyUI already bundles. Manager route: search "comfyui_io_helpers" → install → restart. Manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/Ryuukeisyou/comfyui_io_helpers
Restart ComfyUI and it'll be under the "io_helpers" category.
Common issues
- Failures are silent, then loud downstream. Unlike the file-based loader, bad input here doesn't crash the node - invalid base64 returns
(None, None), and the None then blows up in whatever node you wired next with a confusing "NoneType has no attribute" style error. If something downstream dies mysteriously, check your string first. - Empty or malformed strings land in that same silent-None bucket. A trailing newline or a truncated paste is enough to do it.
- The prefix is optional, not required. Don't waste time stripping it manually - the node handles both. But note that anything before the comma in a
data:URI is discarded, so keep the format clean. - Multi-frame sources (animated GIFs) decode to a whole batch at once, so be ready for the IMAGE to have more than one frame.
For API-shaped pipelines, this is the load half of the pack's base64 pair - boring, dependency-free, and exactly what the round-trip needs.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| base64_string | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |