ImageCompositeMask Adv
A smarter image composite node that handles RGBA and batches for you
- back
- surface
- MaskMix
- Options
- RGBA
- RGB
- A
- Help
ComfyUI's built-in "Image Composite Masked" node is fine until you need something it wasn't built for - proper 4-channel alpha blending, batches of different sizes overlaid on each other, or just not having to think about which combination of RGB/RGBA inputs produces which alpha channel. ImageCompositeMask_Adv is an enhanced drop-in replacement that handles all of that, and - a nice touch - ships its own inline documentation as a Help text output, so you don't have to leave the graph to remember how it works.
It's part of ComfyUI-WJNodes, a personal grab-bag pack from GitHub user 807502278 that spans image editing, video slicing, and file tools. The author flags this particular node's advanced settings as still rough around the edges - "may have bugs, will be fixed as encountered" - so treat the deeper configuration options as a work in progress rather than a finished feature.
How it works
Feed it a back image, a surface image to composite on top, and optionally a MaskMix to control the blend, and it works out sensible defaults depending on what actually has an alpha channel. If neither input has alpha, it composites normally and reports full opacity. If one side has alpha and the other doesn't, that alpha channel carries through to the result. If both surface and back are RGBA, MaskMix blends between the two full images rather than acting as a separate mask layered on top. It also auto-applies batch-matching rules when your inputs have different batch counts - useful for overlaying a single still image onto every frame of a video batch without manually broadcasting it yourself first.
The inputs and outputs that matter
backandsurface(both optional IMAGE) - the base image and the one composited on top of it.MaskMix(optional MASK) - the blend mask between the two, when both are present.Options(optional, a companion "Composite_Basic" settings type from elsewhere in this pack) - feeds in the advanced controls: position, scale, mirror, blend-mode opacity, alpha inversion, custom background, and more. Skip it entirely for the default composite behavior described above.
Outputs: RGBA and RGB (the composited image in both forms), A (just the resulting alpha channel as a mask), and Help (a STRING output carrying the node's own usage notes, readable right in the graph).
How to install it
Via ComfyUI Manager, search "ComfyUI-WJNodes." Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/807502278/ComfyUI-WJNodes.git
Restart ComfyUI. No model downloads are needed - this is pixel/alpha compositing math, not an inference node.
Common issues & troubleshooting
Output alpha isn't what you expected. The default-blending rules depend on exactly which combination of surface/back/MaskMix are connected and which of those already carry an alpha channel - read the Help output first; it documents the node's own cascading logic more precisely than guessing will.
Batch sizes don't match and the node errors instead of auto-matching. Batch auto-matching only works cleanly in specific cases - when two of the three inputs (MaskMix/surface/back) are single images and one is a multi-frame batch, or when two batches are exact multiples of each other. Mismatched batch counts that aren't clean multiples will throw an error rather than guess.
Advanced Options behave unpredictably. The author's own README explicitly flags the advanced settings as still having occasional bugs. If something in the Options path misbehaves, fall back to the simple back/surface/MaskMix inputs without Options connected - that base path is the more stable one.
No outside troubleshooting threads to check. This node has no real public discussion - the Help output is genuinely your best documentation here, more so than for most nodes in this pack, since the author built it specifically to answer "how does this behave" questions inline.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| backopt | IMAGE | — | |
| surfaceopt | IMAGE | — | |
| MaskMixopt | MASK | — | |
| Optionsopt | Composite_Basic | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| RGBA | IMAGE | — |
| RGB | IMAGE | — |
| A | MASK | — |
| Help | STRING | — |