MaskCompositePPM
Combine a stack of masks in one node
- mask_1
- MASK
If you've done any serious inpainting or regional prompting, you've hit this: you have three or four masks and you need to merge them, and ComfyUI's stock MaskComposite only takes two at a time. So you end up chaining a little daisy-chain of composite nodes, each one adding the next mask, and your graph turns into spaghetti. MaskCompositePPM is the quality-of-life fix - combine a whole set of masks in a single node, one operation, done.
What it does
It's exactly what the name says: a mask compositor from the ComfyUI-ppm pack, built to fold multiple masks together without the pairwise chaining. You give it your first mask, choose how they combine, and it returns one merged MASK. Under the hood it's doing per-pixel math between the masks - the same kind of blend/boolean logic the stock node does, just collapsed into one place.
Where this shows up in real workflows: regional prompting and attention coupling (this pack's own AttentionCouplePPM leans on masks heavily), multi-subject inpainting where you're carving the frame into zones, and any time you're building a composite selection out of several LatentToMaskBB bounding boxes or segmentation outputs. Anywhere you'd otherwise stack a row of MaskComposite nodes, this replaces the row.
The inputs that matter
- mask_1 (MASK) - your first mask, the base of the composite. This pack's nodes tend to grow their inputs as you wire things in, so treat
mask_1as the starting point of the stack rather than a hard limit. - operation (default
add) - how the masks combine.addunions them (bright where any mask is bright), which is the sensible default for "select all these regions." Other operations combine them differently - swap it if you want intersection or subtraction behavior rather than a union.
Output is a single MASK, ready to feed wherever a mask goes: an inpaint node, SetLatentNoiseMask, a conditioning area, an attention-couple region.
Install
No models, no dependencies - it's image math.
- ComfyUI Manager: search "ComfyUI-ppm", install, restart.
- Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/pamparamm/ComfyUI-ppm, then restart.
Common issues & troubleshooting
Mask sizes must match. The single most common composite failure across all mask-combining nodes: your masks are different resolutions. If the node errors or produces garbage, check that every mask you're feeding it is the same width and height - resize them to a common size first.
The result isn't what you expected. That's almost always the operation setting. add gives you a union; if you wanted "only where both masks overlap" or "this region minus that one," you need a different operation. It's the one knob here, so if the composite looks wrong, it's the first (and usually only) thing to change.
Empty or all-black output. Trace back to your source masks - if an upstream segmentation or bounding-box node produced an empty mask, compositing it can wipe the result depending on the operation. Preview each input mask individually before blaming this node.
Pack rule from the author: if it starts throwing errors after a pack update, delete the node and re-add it - that clears stale state.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| mask_1 | MASK | — | |
| operation | COMBO | add | 6 options: multiply, add, subtract, and, or, xor |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |