Nodes/AQnodes for ComfyUI/AQ_LoadImageBase64
ComfyUI Node

AQ_LoadImageBase64

Turn a base64 image string into a ComfyUI IMAGE (and a mask from the alpha)

By 2frames·Created about a year ago·Updated 6 months ago· 1
AQ_LoadImageBase64
    • IMAGE
    • MASK
    image

    ComfyUI's normal Load Image reads files. This one reads a base64-encoded image string - which is how images come back from web APIs, HTTP endpoints, and other nodes that hand you data instead of paths. It's the glue for API-driven workflows: something out there produces an image as text, and this node makes it a real tensor inside your graph.

    How it works

    It base64-decodes the string, opens it with PIL, and converts it to the same float tensor format the core loader produces. The mask output is where it gets interesting: if the image has an alpha channel, the alpha becomes a MASK - 1 where the pixel is fully transparent, 0 where it's opaque, matching ComfyUI's convention that 1 = region to affect. If there's no alpha channel, it returns a dummy 64×64 zero mask instead.

    Inputs

    • image - a base64 string, single line.

    Outputs

    IMAGE, and MASK (derived from alpha, if present).

    Install

    Ships in AQnodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/2frames/ComfyUI-AQnodes
    cd ComfyUI-AQnodes
    pip install -r requirements.txt
    

    or search "AQnodes" in ComfyUI Manager and restart.

    Gotchas

    The mask output is only meaningful for images that actually carry alpha. Feed it a JPEG and you get a 64×64 zero mask - which is not the same size as the image, so wiring it into inpainting will produce something broken or confusing. If you need a real mask, feed an RGBA PNG. And there's no validation: a malformed base64 string just throws a decode error, so make sure whatever you're piping in is actually valid base64 of a decodable image. For the API round-trip use case, this pairs naturally with the pack's save/return side - encode on the way out, decode back in here.

    CategoryAQ/Image

    Inputs (1)

    NameTypeDefaultDescription
    imageSTRING

    Outputs (2)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK