遮罩拼接
Sew two masks into one, side by side or stacked
- 遮罩1
- 遮罩2
- 拼接遮罩
Sometimes you don't want to merge masks (overlap them), you want to stitch them together into one bigger canvas - a face region plus a hands region laid side by side, or a top-half mask and a bottom-half mask stacked into a single composite. That's MaskConcatenate: it takes 遮罩1 and 遮罩2 and places them on one output canvas, joined either 左右 (side by side, default) or 上下 (stacked vertically). The output is a single MASK, 拼接遮罩, that you then feed anywhere you'd feed one mask.
Why would you want that? It's a build-your-own-region tool. In detailer and inpainting pipelines (the KB's masking-and-detailing doc covers the pattern), you often want one mask that covers several disconnected areas - but many downstream nodes want a single mask tensor, and some inpainting setups work best when the selected region is presented as one shape. Concatenate is also handy when you're assembling a composite image from separately-masked pieces: stitch the masks the same way you'll stitch the pixels, and everything lines up.
Two things to know about how it behaves:
- 匹配尺寸 (off by default). When off, the two masks are placed as-is on the output canvas, and the canvas is sized to fit - the joined result has each mask at its original resolution, with blank space where they don't overlap. When on, the smaller mask gets stretched (bilinear) to match the bigger one before joining, so the halves are uniform. Leave it off if your masks are already the same size; turn it on if they come from different sources and you want a tidy composite.
- It normalizes masks to 2D first, taking the max across channels if your mask comes in as a batch. It's forgiving about mask shapes, which saves you the usual "shape mismatch" pain.
There's one honest caveat: it's a placement stitch, not a smart blend. Where the two masks meet there's a hard seam, and if the two halves were meant to overlap you'll get one drawn over the other (the first mask wins the overlap region). For overlapping regions you want a union merge instead - the same pack's MaskMergeList does OR-combining and is the right tool when regions genuinely overlap.
Install
ComfyUI Manager → search "muye" → install "ComfyUI-Muye-nodes", restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/muyexiuluo/ComfyUI-Muye-nodes
cd ComfyUI-Muye-nodes
pip install -r requirements.txt
then restart. Pure torch here - no extra deps. The README's manual block shows an older ComfyUI_Muye.git URL; use the -nodes one above. Labels are Chinese by design (display name 遮罩拼接; 拼接方向 is the join direction, 匹配尺寸 is size-matching). If the node doesn't appear, look for [Muye] Failed to load module in the console - the pack silently skips modules that fail to import.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| 遮罩1 | MASK | — | |
| 遮罩2 | MASK | — | |
| 匹配尺寸 | BOOLEAN | false | — |
| 拼接方向 | COMBO | 左右 | 2 options: 左右, 上下 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| 拼接遮罩 | MASK | — |