Nodes/comfyui_bmab/BMAB Base64 Image
ComfyUI Node

BMAB Base64 Image

Getting an image into your graph from a string

By portu-sim·Created 2 years ago·Updated 8 months ago· 124
BMAB Base64 Image
    • image
    • width
    • height
    encoding
    image

    Most of the time you get images into a ComfyUI graph by loading a file. Sometimes that's not the shape your data comes in - you're receiving an image inline as text, from an API call, a webhook payload, or a script that never touched disk. That's the gap this node fills.

    What it is and why you'd reach for it

    BMAB Base64 Image decodes a base64-encoded image string directly into a usable IMAGE tensor in your graph, no file upload required. If you're building or debugging a pipeline where images arrive as text - say, a JSON payload from an external service, or a base64 blob you're pasting in while testing - this node is the entry point instead of Load Image.

    That's a genuinely useful shape if you're running ComfyUI workflows through an API rather than the web UI: passing image data inline as a string sidesteps needing a separate upload step, at the cost of a bulkier payload. If your workflow is purely interactive in the browser, you probably won't reach for this over just dragging a file in.

    How it works

    You paste (or programmatically inject) a base64-encoded image string into the encoding field, and the node decodes it back into pixels, reporting the resulting image's width and height alongside it. Decoding a base64 string is exact and lossless with respect to whatever image format was encoded - you get back precisely what was encoded, not a re-compressed approximation.

    Inputs and outputs

    • encoding (required, multiline string) - the base64-encoded image data. This is the field that actually drives the node.
    • image (required, dropdown of files from your ComfyUI input folder) - a standard file-picker widget that ComfyUI attaches to image-handling nodes by convention. If you're relying on this node specifically for its base64 decoding, the encoding field is what matters; don't be surprised the node also carries the usual file dropdown alongside it.

    Outputs:

    • image - the decoded IMAGE, ready to wire anywhere a normal loaded image would go.
    • width / height - the decoded image's dimensions as plain integers, handy if a downstream node needs them explicitly (a resize node, a crop calculation, or just a sanity check that what came through matches what you expected).

    Installing it

    Through ComfyUI Manager: search comfyui_bmab, install, and restart. Manual install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/portu-sim/comfyui_bmab.git
    cd comfyui_bmab
    pip install -r requirements.txt
    

    (Windows portable users: swap in python_embeded\python.exe -m pip install -r requirements.txt.) This node is plain Python string/image handling - no GPU model, no extra weights, and it doesn't depend on BMAB's two optional companion packs (comfyui_controlnet_aux, ComfyUI_IPAdapter_plus). The base install covers it.

    Common issues

    Base64 decoding failures are almost always about the string itself, not the node:

    • A data URL prefix left on the string. If your base64 came from a browser or a <img src="data:image/png;base64,..."> context, make sure you're pasting only the part after the comma - the data:image/png;base64, prefix isn't valid base64 and will break decoding if it's still attached.
    • Truncated or whitespace-mangled strings. Copy-pasting a very long base64 string through some terminals or text fields can introduce line breaks or drop characters. If decoding fails outright, try re-copying the string as a single unbroken block.
    • Wrong image format assumptions downstream. The node reports width/height from whatever was actually decoded - if those numbers look wrong, the issue is almost certainly the source string, not this node misreading it.
    CategoryBMAB/utils

    Inputs (2)

    NameTypeDefaultDescription
    encodingSTRING
    imageCOMBO1 options: example.png

    Outputs (3)

    NameTypeDescription
    imageIMAGE
    widthINT
    heightINT