Nodes/Bjornulf_custom_nodes/๐Ÿ“ฅ๐Ÿ–ผ Load Image with Transparency โ–ข
ComfyUI Node

๐Ÿ“ฅ๐Ÿ–ผ Load Image with Transparency โ–ข

Keep the alpha channel

By justUmenยทCreated 2 years agoยทUpdated about a year agoยท 545
๐Ÿ“ฅ๐Ÿ–ผ Load Image with Transparency โ–ข
    • image
    • mask
    • image_path
    โ—„imageโ–พโ–บ

    Here's the annoying thing this node exists to fix: ComfyUI's built-in Load Image node throws away transparency. Feed it a PNG with a cut-out subject on a transparent background and it flattens the alpha, so your carefully rembg'd character comes back sitting on solid black. If you need the actual transparency preserved - for compositing, overlays, or any downstream node that expects RGBA - the stock loader won't do it. This one will.

    That's the whole pitch. It's a small, boring, essential utility, and if you've ever wondered why your transparent PNG lost its transparency the moment it entered the graph, this is your answer.

    How it works

    It loads the file straight off disk as RGBA and hands you back three things: the image with its alpha intact, the alpha channel itself as a mask, and the file path. Nothing fancy - it just doesn't do the destructive flatten that the default loader does. If you work with background-removed images (BiRefNet, rembg, InSPyReNet - see the background-removal notes in the KB), this is the loader that respects what those tools produced.

    The inputs and outputs that matter

    • image (the required input) - a dropdown of images in your ComfyUI input folder, exactly like the standard Load Image picker. Drop your transparent PNG in the input folder and select it here.

    Outputs, three of them:

    • image (IMAGE) - the loaded image with transparency preserved.
    • mask (MASK) - the alpha channel as a mask, so you can drive inpainting, compositing, or a cut straight off the transparency without a separate extraction step.
    • image_path (STRING) - the full path to the file, useful for logging or feeding path-based nodes.

    The mask output is the quietly useful part. A transparent PNG already is a mask if you look at its alpha, and this node just hands it to you.

    How to install it

    ComfyUI Manager is the easy route - search Bjornulf_custom_nodes, install, restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/justUmen/Bjornulf_custom_nodes
    pip install -r Bjornulf_custom_nodes/requirements.txt
    

    then restart. This particular node is pure image loading with no special dependency, so even if the pack's heavier deps (ffmpeg, ollama, etc.) fail to install, this one will still work.

    Common issues & troubleshooting

    The transparency is still gone downstream. Loading it correctly is only half the battle - plenty of nodes (VAE encode, some samplers, most save-as-JPEG paths) don't understand alpha and will flatten or ignore it. Keep the image in RGBA-aware nodes, and when you finally save, save as PNG or webm, not JPEG. If a specific node chokes on RGBA, the pack's own "Remove image Transparency" node fills the alpha with a solid color to make it RGB again.

    Your file doesn't show in the dropdown. Same rule as the stock loader: the image has to be in ComfyUI's input folder. Drop it there and refresh.

    The mask looks inverted. Different nodes disagree on whether "white = keep" or "white = mask out." If your composite is backwards, invert the mask - that's a convention mismatch, not a bug here.

    The alpha is hard-edged and ugly. That's your source image, not the loader. Transparency quality is set by whatever background remover made the PNG; a crunchy matte comes in crunchy. Redo the removal with a better model if the edges matter.

    CategoryBjornulf

    Inputs (1)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png

    Outputs (3)

    NameTypeDescription
    imageIMAGEโ€”
    maskMASKโ€”
    image_pathSTRINGโ€”