Nodes/ComfyUI-ImageCompositionCy/Load Image (Alpha) 🖼️
ComfyUI Node

Load Image (Alpha) 🖼️

Stop losing your alpha channel in ComfyUI

By CY-CHENYUE·Created about a year ago·Updated about a year ago· 12
Load Image (Alpha) 🖼️
    • IMAGE
    image

    Every ComfyUI beginner hits this eventually: you load a transparent PNG, wire it into the graph, and the transparency is gone. Core LoadImage keeps the alpha as a separate MASK output and hands downstream nodes an RGB image - the fourth channel silently vanishes the moment you try to composite. Load Image (Alpha) 🖼️ fixes exactly that: it loads your PNG and keeps the RGBA intact.

    It's one of three nodes in CY-CHENYUE's small ImageCompositionCy pack, and it exists primarily to feed that pack's Image Compositor, whose entire point is layering transparent images on a canvas. It's not locked to the compositor, though - it works as a general "give me the alpha channel" loader anywhere a 4-channel tensor is tolerated. Just know that a lot of ComfyUI nodes assume RGB and will quietly drop the extra channel further down your pipeline, so test the specific chain you're building.

    How it works

    Under the hood it's a cleaner, alpha-preserving version of the standard loader. It reads from the same input folder, fixes EXIF orientation, checks whether the file actually has an alpha band (looking at getbands() and palette-mode transparency), converts to RGBA - adding an opaque alpha if there was none - and returns a [1, H, W, 4] tensor. Multi-frame images get iterated into a batch. It hashes the file contents so ComfyUI knows when you've swapped the image, and it validates the path at connect time, so it behaves exactly like the stock loader minus the channel-dropping.

    Inputs and outputs

    One input: image, an enum of every image file in your input folder, with the usual upload widget. One output: IMAGE, in RGBA. Wire it straight into ImageCompositor's overlay_image_* inputs, or into anything that accepts a 4-channel image.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/CY-CHENYUE/ComfyUI-ImageCompositionCy.git
    cd ComfyUI-ImageCompositionCy
    pip install -r requirements.txt
    

    Restart after, or install via ComfyUI Manager by searching "ImageCompositionCy". No models to download - the requirements.txt (pillow, numpy, torch) is already satisfied by any working ComfyUI install.

    Gotchas

    If something downstream looks washed out or wrong, the most likely culprit is a node that assumed RGB and silently discarded the alpha - switch to a consumer that accepts RGBA, or convert deliberately instead of letting a node do it for you. And don't load RGBA and then force it through a plain RGB node, because that destroys the exact thing you loaded it for. In other words: this node is only as good as the rest of your pipeline's willingness to carry four channels.

    CategoryImageCompositionCy

    Inputs (1)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE