๐ผ+๐ผ Stack two images (Background+Overlay alpha)
Composite a transparent overlay onto a background
- background
- overlay
- mask
- image
- mask
This is a simple compositing node: it stacks one image (the overlay) on top of another (the background) and lets you position the overlay wherever you want. The overlay is meant to have transparency - think a subject with the background removed, dropped onto a new scene. In the pack's menu it's the "Stack two images (Background + Overlay)" node.
It's the classic "put this cutout on that background" move. Pair it with a background-removal node (rembg, BiRefNet, or the pack's own Green Screen to Transparency) upstream, and this is what places the result.
How it works
You feed it a background and an overlay. The overlay's alpha channel decides what shows through, and the two position sliders decide where it lands. The positions are expressed as percentages that run from โ50 to 150, which sounds odd until you realize it lets you push the overlay partly (or fully) off the edges of the background - 50/50 is dead center, 0/0 is up and to the left, 100/100 is down and to the right, and negative or >100 values slide it off-frame. There's also an optional mask input if you want to control the overlay's transparency explicitly rather than relying on its baked-in alpha.
One limitation the author flags: the background is treated as a single static image. You can run video frames through the overlay side by sending all the frames, but don't expect a moving background here.
The inputs and outputs that matter
background- the base image.overlay- the image placed on top, ideally with transparency.horizontal_positionandvertical_position- where the overlay sits, as percentages from โ50 to 150 (default 50 each = centered). This is the pair you'll actually tune.mask(optional) - an explicit MASK to control what of the overlay shows through.
Outputs are image (the composite) and mask (the resulting mask), so you can chain further compositing if needed.
How to install it
ComfyUI Manager: search Bjornulf_custom_nodes, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/justUmen/Bjornulf_custom_nodes
Restart ComfyUI. This is a pure image operation and doesn't need the pack's heavy dependencies, though installing requirements.txt is fine if you'll use other nodes.
Common issues
The big one: if your overlay has no real transparency, you'll just see it slapped as an opaque rectangle over the background. Make sure whatever produced the overlay actually preserved an alpha channel - and note that ComfyUI's default Load Image node strips transparency, so use the pack's "Load Image with Transparency" node (or feed the mask input) if the overlay looks like a solid block.
If the overlay lands in the wrong spot or partly off-screen, that's the โ50 to 150 percentage scale doing its thing; nudge the two position sliders back toward 50. And remember the background is static - for a moving-background composite you'll need a different approach.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| background | IMAGE | โ | |
| overlay | IMAGE | โ | |
| horizontal_position | FLOAT | 50.0-50โ150 | โ |
| vertical_position | FLOAT | 50.0-50โ150 | โ |
| maskopt | MASK | โ |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | โ |
| mask | MASK | โ |