Masks Combine Regions
Merge several masks into one
- mask_a
- mask_b
- mask_c
- mask_d
- mask_e
- mask_f
- mask_g
- mask_h
- mask_i
- mask_j
- mask_k
- mask_l
- mask_m
- mask_n
- mask_o
- mask_p
- mask_q
- mask_r
- mask_s
- mask_t
- mask_u
- mask_v
- mask_w
- mask_x
- MASK
Two or more masks in, one combined mask out. It's the union operation for masks - wherever any input mask is white, the output is white. The pack states it plainly: "combine 2 or more masks into one mask."
You end up needing this constantly once you're doing anything with more than one masked region. You segmented a person and a bag separately and want to inpaint both. You built three rectangular regions and want them treated as one selection. You've got a face mask and a hand mask and want a single "detail these" mask. Combine Regions welds them together.
Why you'd reach for it
Masking pipelines tend to produce masks piecemeal. SAM gives you one object at a time. Rectangle nodes give you one box at a time. Threshold and region nodes isolate one blob. But the sampler wants a single mask telling it everywhere to work. Combine Regions is the merge step that turns a pile of individual selections into the one mask your inpaint pass actually consumes.
It also opens up compositional masking: build masks with completely different tools - a SAM object here, a hand-painted region there, a thresholded area from a depth map - and OR them into one coherent selection. Each source does what it's best at; Combine Regions assembles the result.
How it works
It takes multiple mask inputs and merges them by taking the maximum at each pixel - the union. A pixel that's white in any input is white in the output; a pixel that's black in all of them stays black. Simple, predictable, order-independent. (If you need subtraction - remove one mask from another - or addition with different math, WAS has separate Mask Subtract and Mask Add nodes; this one is the straight combine.)
The inputs and outputs that matter
- two or more MASK inputs - the masks you want merged. Wire in the regions you've built.
The output is a single MASK representing the union of them all. It flows into a Set Latent Noise Mask, an inpaint encode, or further mask ops (dilate, blur, crop) before you use it.
Installing it
Comes with WAS Node Suite. ComfyUI Manager: search WAS Node Suite, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui
install requirements.txt against your ComfyUI Python, restart.
Common issues
The combined mask is bigger than expected / regions bled together. That's the union working as designed - overlapping or adjacent masks merge into one continuous region. If you wanted them kept separate, don't combine them; process each mask independently instead.
One input mask isn't showing up in the result. Check it actually has white pixels - an empty or all-black mask contributes nothing to a union. Preview each input before combining.
Sizes don't match. Masks being combined should describe the same canvas. If one mask is a different resolution than the others, resize it to match first, or you'll get misaligned or truncated results.
Node's gone after a ComfyUI update. Pack-level, not this node. WAS Node Suite is retired and no longer maintained; its dependency pins clash with ComfyUI updates and throw "Import Failed," which pulls every WAS node offline until you reinstall the pack's requirements.txt against the correct ComfyUI environment.
Straightforward node, no models, no VRAM, nothing to tune. It's one of a whole family of WAS mask utilities (Add, Subtract, Combine Batch, Dominant/Minority Region, Fill, Smooth) - reach for Combine Regions specifically when you have several distinct masks and want them treated as one.
Inputs (24)
| Name | Type | Default | Description |
|---|---|---|---|
| mask_a | MASK | The first mask to merge, and the fallback: if every slot turns out to hold an empty 64x64 placeholder, this is what comes back out. | |
| mask_b | MASK | The second mask to merge. All the masks wired in must be the same width and height. | |
| mask_copt | MASK | A third mask to merge in. Leave it unconnected to skip it. | |
| mask_dopt | MASK | A fourth mask to merge in. Leave it unconnected to skip it. | |
| mask_eopt | MASK | A fifth mask to merge in. Leave it unconnected to skip it. | |
| mask_fopt | MASK | A sixth mask to merge in. Leave it unconnected to skip it. | |
| mask_gopt | MASK | Mask 7, drawn onto the result. Unconnected is skipped. | |
| mask_hopt | MASK | Mask 8, drawn onto the result. Unconnected is skipped. | |
| mask_iopt | MASK | Mask 9, drawn onto the result. Unconnected is skipped. | |
| mask_jopt | MASK | Mask 10, drawn onto the result. Unconnected is skipped. | |
| mask_kopt | MASK | Mask 11, drawn onto the result. Unconnected is skipped. | |
| mask_lopt | MASK | Mask 12, drawn onto the result. Unconnected is skipped. | |
| mask_mopt | MASK | Mask 13, drawn onto the result. Unconnected is skipped. | |
| mask_nopt | MASK | Mask 14, drawn onto the result. Unconnected is skipped. | |
| mask_oopt | MASK | Mask 15, drawn onto the result. Unconnected is skipped. | |
| mask_popt | MASK | Mask 16, drawn onto the result. Unconnected is skipped. | |
| mask_qopt | MASK | Mask 17, drawn onto the result. Unconnected is skipped. | |
| mask_ropt | MASK | Mask 18, drawn onto the result. Unconnected is skipped. | |
| mask_sopt | MASK | Mask 19, drawn onto the result. Unconnected is skipped. | |
| mask_topt | MASK | Mask 20, drawn onto the result. Unconnected is skipped. | |
| mask_uopt | MASK | Mask 21, drawn onto the result. Unconnected is skipped. | |
| mask_vopt | MASK | Mask 22, drawn onto the result. Unconnected is skipped. | |
| mask_wopt | MASK | Mask 23, drawn onto the result. Unconnected is skipped. | |
| mask_xopt | MASK | Mask 24, drawn onto the result. Unconnected is skipped. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | One mask covering every area set in any of the inputs. The values are added and then clamped to 0-1, so overlaps come out solid white rather than overflowing. |