BMAB Alpha Composit
Layering two images together, transparency and all
- image1
- image2
- alpha
- image
This is one of the plainer nodes in the BMAB pack, and that's not a knock - sometimes you just need to stack two images together properly, and a dedicated node beats hand-rolling it with math nodes every time.
What it is and why you'd reach for it
Alpha compositing is the standard way of layering a foreground image over a background using per-pixel transparency, the same operation behind every PNG-with-alpha you've ever opened in Photoshop or GIMP. In a ComfyUI graph you'll want it anywhere you're combining a generated element with a background - pasting a subject you cut out onto a new scene, layering a rendered overlay (text, a watermark, a UI element) onto a finished image, or combining outputs from two different generation passes where one is meant to sit "on top of" the other with soft edges.
It's a narrower tool than BMAB Blend, which sits right next to it in the pack - Blend does a flat opacity mix between two full images (like a crossfade), while Alpha Composit respects per-pixel transparency via a mask, so only the parts you've actually marked as transparent let the background show through. If you want a uniform 50% fade between two images, use Blend. If you want image A pasted onto image B with a clean, mask-defined edge, this is your node.
How it works
You give it two images and an optional mask. Wherever the mask says "opaque," image1 shows through; wherever it says "transparent," image2 shows through; and it blends smoothly at partial-transparency edges rather than producing a hard cutout. If you don't supply a mask, the node still runs, but you lose the actual point of alpha compositing - pairing it with a real mask (from BMAB's own detection nodes, a manual paint mask, or a background-removal node) is what makes this useful rather than a no-op.
Inputs and outputs
- image1 (required) - the foreground layer.
- image2 (required) - the background layer.
- alpha (optional, MASK) - the transparency mask that decides how the two blend together.
Output is a single composited image, ready to save or feed into the next step of your workflow.
Installing it
Through ComfyUI Manager: search comfyui_bmab, install, restart. Manually, if you'd rather do it by hand:
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: python_embeded\python.exe -m pip install -r requirements.txt.) Restart ComfyUI when it's done. This node doesn't touch either of BMAB's two optional companion packs (comfyui_controlnet_aux, ComfyUI_IPAdapter_plus) - it's plain image math, so the base install is all you need.
Common issues
There's not much documented failure surface for a node this simple, but a few things trip people up in practice with alpha compositing generally:
- No mask connected, so nothing visibly changes. Without a mask wired into
alpha, you won't get the layered effect you're expecting - double-check the mask is actually connected and isn't coming out blank (all-black or all-white) from whatever node produced it. - Mask and image size mismatch. If your mask came from a different-resolution source than your two images, resize it to match first - compositing nodes across ComfyUI generally expect the mask dimensions to line up with the images.
- Reaching for this when you actually wanted a flat blend. If your result looks like a hard cutout with visible edges rather than a smooth combination, you might actually want BMAB Blend's uniform-opacity mix instead, or a softer/feathered mask feeding into this node.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image1 | IMAGE | — | |
| image2 | IMAGE | — | |
| alphaopt | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |