Mask Batch Multi
Combine any number of masks into one batch
- mask_1
- mask_2
- masks
Mask Batch Multi does one job: take however many separate MASK inputs you've got and bundle them into a single batch. It sounds trivial until you're the one holding five masks from five different detectors and no clean way to feed them all into a single downstream node at once.
Why you'd want this
A lot of ComfyUI nodes that process masks - batch inpainting, per-subject masking, applying an effect region by region - expect a single batched MASK input, not five separate wires. If you've generated multiple masks (one per detected subject, one per region of interest, one per frame of a short clip processed individually) they normally sit as separate outputs until something combines them. This node is that combining step: wire your individual masks in, get one batched MASK out, and hand that straight to whatever downstream node wants a batch.
How it works
Like the pack's other "Multi" nodes, the input count isn't fixed - it's driven by the inputcount widget. Set it to however many masks you're feeding (it starts at 2, since combining fewer than that wouldn't need a "multi" node at all), click update, and the node exposes that many numbered mask slots to wire up. Once every slot has a mask connected, the single masks output carries them all as one batch.
The inputs and outputs that matter
inputcount(default 2, range 2–1000) - how many mask slots the node exposes. Set this before wiring, since it determines how many numbered inputs (mask_1,mask_2, and onward) appear.mask_1,mask_2(required for the base count of 2; more appear as you raiseinputcount) - your individual masks, in whatever order you want them batched.masks(MASK) out - all your inputs combined into a single batch.
Installing it
Ships with the pack:
- ComfyUI Manager - search KJNodes for ComfyUI, install, restart.
- Manual -
cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes, thenpip install -r ComfyUI-KJNodes/requirements.txt, restart.
Nothing to download beyond the base pack - it's tensor stacking, no model behind it.
Common issues & troubleshooting
Node doesn't show enough mask slots. Raise inputcount first - the numbered inputs only appear up to whatever count you've set, so if you need to combine six masks, inputcount has to be at least 6 before those slots show up to wire.
Batch error downstream, or an unexpected shape. The most common cause with any mask-batching node is your individual masks not sharing the same resolution. If your masks came from different sources (different detectors, different image sizes upstream), resize them to a common resolution before feeding them in here - batching assumes matching dimensions, it doesn't reconcile mismatched ones for you.
Only have two masks and this feels like overkill. It's a fine tool even at the minimum count of 2 - the "Multi" naming is about supporting an arbitrary count, not requiring a large one. If you genuinely only ever have exactly two masks and never more, a simpler two-input mask-combine node elsewhere in the ecosystem might be a lighter-weight fit, but this one works fine either way.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| inputcount | INT | 22–1000 | — |
| mask_1 | MASK | — | |
| mask_2 | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| masks | MASK | — |