Nodes/ComfyUI Easy Use/Load Image (Base64)
ComfyUI Node Runs on cloud

Load Image (Base64)

Feed an image into a workflow as a string

By yolain·Created 3 years ago·Updated 8 days ago· 2,633
Load Image (Base64)
    • IMAGE
    • MASK
    base64_data
    image_outputPreview
    save_prefixComfyUI

    Normal image loading in ComfyUI means a file sitting in your input folder. That's fine at your desk and useless over an API. easy loadImageBase64 takes the image as a base64 string instead, decodes it to an IMAGE (and a MASK), and drops it into the graph. It's the node you use when the image arrives as data, not as a file on disk.

    It's a Load Image variant in ComfyUI-Easy-Use, and it's quietly one of the most useful nodes in the pack for anyone running ComfyUI programmatically - including anyone driving a workflow through a cloud API like comfy.icu.

    Why you'd reach for it

    Because API-driven generation has an awkward gap: how do you get your image into a workflow you're triggering remotely? Uploading a file to a server first, then referencing it by name, is a whole extra step. With this node, you embed the image right in the prompt JSON as a base64 string - one request, image included. Send a user's uploaded photo straight into an img2img or a ControlNet or an IPAdapter without a separate upload round-trip. If you're building an app on top of ComfyUI, this is how you hand it images.

    How it works

    You put a base64-encoded image string into the base64_data field (usually set from your API call, not typed by hand). The node decodes that string back into pixels and outputs a standard IMAGE, plus a MASK derived from the image's alpha channel if it has one. From there it behaves exactly like any other loaded image - wire it into whatever needs an input picture.

    The inputs and outputs

    • base64_data - the base64 string of your image. This is the whole input; in practice you set it via the API rather than in the UI.
    • image_output - Preview / Save / Hide / Hide-Save, for whether to also show or write the decoded image.
    • save_prefix - filename prefix if you save.

    Outputs: IMAGE and MASK. The mask comes from the alpha channel, which is handy - send a PNG with transparency and you get both the picture and its cutout mask in one node.

    Installing it

    ComfyUI Manager: search ComfyUI Easy Use, install, restart. Or cd ComfyUI/custom_nodes && git clone https://github.com/yolain/ComfyUI-Easy-Use, install requirements, restart. No models or extra dependencies.

    Where people trip

    The number-one issue is the string format. Base64 image data sometimes comes with a data-URI prefix (data:image/png;base64,....) and sometimes as the raw payload - if the node errors on decode, check whether you need to strip (or keep) that prefix for your setup. Second, base64 inflates size by roughly a third, so a big image makes a big prompt payload; for large inputs an upload-then-reference flow can be leaner. Third, remember the string has to be valid base64 of an actual image - a truncated or mangled string (easy to produce when copying by hand) just fails to decode. In an API context, encode server-side and pass it through cleanly and it's rock solid.

    CategoryEasyUse/Image/LoadImage

    Inputs (3)

    NameTypeDefaultDescription
    base64_dataSTRING
    image_outputCOMBOPreview4 options: Hide, Preview, Save, Hide/Save
    save_prefixSTRINGComfyUI

    Outputs (2)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK