Multiple Mask Stitch
Stitch Masks Side by Side — Hard Edges Stay Hard
- mask_1
- mask_2
- mask_3
- stitched_mask
- mask_list
Masks don't stitch themselves. If you've ever tried to join two inpaint regions - say you masked the left half of an image in one node and the right half in another and want to treat them as a single region - you've hit the wall where core ComfyUI gives you the raw tensors and expects you to figure it out. Multiple Mask Stitch is the sibling of this pack's image stitcher, tuned for MASK inputs instead of IMAGE ones.
It's the same idea as Multiple Image Stitch but for the greyscale mask tensors ComfyUI uses everywhere from inpainting to regional prompting: feed it 2–50 masks, get one combined mask, or a flat list of the individual ones.
How it works
The mechanism mirrors the image version, with one deliberate difference: it resizes using nearest-neighbor interpolation rather than bilinear. That's the detail that matters. When you're stitching masks, a bilinear pass would smear the edges into soft greys - which then become half-strength inpaint coverage or semi-transparent selection. Nearest keeps every edge crisp, exactly as hard as it was before the stitch.
As with the image node, everything is flattened first - batch tensors and lists get unpacked into individual [1, H, W] masks, then resized to match the first mask's dimensions along the seam axis:
direction= "right" matches heights, glues left to right.direction= "down" matches widths, stacks top to bottom.
The size widget does a final resize if you want a specific output dimension; -1 keeps it as stitched.
The inputs that matter
inputcount- number of masks, up to 50. Change it, then hit the "Update inputs" button so the extramask_Nports actually appear.mask_1- the reference mask; all others are resized to its dimensions.direction- "right" or "down", default "right".size- optional global resize, default-1.
Outputs are stitched_mask (a single MASK) and mask_list (the flat list of all input masks - useful for feeding a batch of separate regions into something that expects a list).
Installing it
Install the whole pack once - all four nodes come from judian17/ComfyUI-multiple-inputs:
cd ComfyUI/custom_nodes
git clone https://github.com/judian17/ComfyUI-multiple-inputs
cd ComfyUI-multiple-inputs
pip install -r requirements.txt
Or search "ComfyUI-multiple-inputs" in ComfyUI Manager. Restart after installing. Dependencies are just numpy and scipy - no models, no downloads. The nodes appear under MyTemplate.
The honest caveats
Same "Update inputs" trap as its image sibling: set inputcount and forget to click the button and your extra inputs simply don't exist yet - the node just silently stitches what's connected.
And set expectations: this is a join, not an overlay. If your masks overlap or you wanted one pasted on top of the other, you're reaching for the wrong node - this one only ever lays them end to end. For region masks that already share a canvas, it's exactly what you want, and the nearest-neighbor resize means what you stitch is what you inpaint.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| inputcount | INT | 32–50 | Number of inputs. |
| mask_1 | MASK | Base mask for dimensions. | |
| direction | COMBO | right | 2 options: right, down |
| size | INT | -1-1–8192 | — |
| mask_2opt | MASK | — | |
| mask_3opt | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| stitched_mask | MASK | — |
| mask_list | MASK | — |