Batch Alpha Composite
Overlay transparent layers, a whole batch at once
- bottom_images
- top_images
- IMAGE
BatchAlphaComposite is the "put this on top of that" node for image batches - the thing ComfyUI strangely lacks a stock version of. It takes two batches of images and alpha-composites them: a top_images layer with transparency over a bottom_images background, for every frame, in one pass. If you've ever wanted to overlay a logo, a watermark, or a foreground element with a soft edge onto a whole video sequence without doing it frame-by-frame in an editor, this is the node.
The contract is strict and worth reading before you wire it up: bottom_images must be RGB (3 channels) and top_images must be RGBA (4 channels). The bottom is your background - the video frames, typically. The top is the overlay with the alpha channel. The node validates both and raises a clear error if you feed the wrong channel counts, which is more than most batch nodes bother with. Output is a single IMAGE batch in RGB, same batch length as the inputs.
The math is the classic alpha blend, applied per pixel: result = alpha * foreground + (1 - alpha) * background. Where alpha is 1, you see the top image fully; where it's 0, you see the bottom; everything between is a proportional mix. That's it - no gamma tricks, no premultiplication fuss. It's the same operation you'd get from a "Composite (over)" node, except it runs across whole batches rather than one image at a time, which is the entire point. Doing this with per-image nodes across a 300-frame sequence is a graph-building nightmare; this is one node.
Where it actually earns its keep in an AI workflow: overlaying generated transparent elements onto video frames. Say you've generated a batch of PNG overlays (a title treatment, a particle pass, a face-replacement patch) with an alpha channel and you want them composited over a rendered video. Or you're doing a two-layer animation where the foreground and background were generated separately. Any place where "one layer sits on another for N frames" is the requirement, this is the shortest path.
The traps are all about input hygiene. If your "top" images come out of a node that strips alpha (some loaders do), you'll get the 4-channel error - fix it by re-adding an alpha channel upstream, not by complaining at the node. And both batches need compatible dimensions; the node validates channel count but mismatched sizes will trip you up downstream, so keep your overlay and background at the same resolution. One more honest note: it does a straight over blend with no per-frame blend control baked in - if you want the overlay to fade in over time, animate the alpha upstream (there are plenty of alpha-timeline nodes for that) and feed the result here.
No models, no downloads, pure tensor ops - GPU when available, CPU fallback. Install: ComfyUI Manager → "DJZ-Nodes", or cd ComfyUI/custom_nodes && git clone https://github.com/MushroomFleet/DJZ-Nodes && pip install -r requirements.txt. It's one of the lightweight ones in a heavy pack.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| bottom_images | IMAGE | — | |
| top_images | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |