Mask List to Mask Batch
Collapse a looping list of masks into one stacked tensor
- mask
- MASK
ComfyUI has two ways of handling "more than one mask": a list, where a downstream node runs once per item and loops through them, and a batch, where a single stacked tensor gets processed all at once. This node is the converter from the first shape to the second - feed it a MASK list, get a MASK batch back.
(One small naming note, since it might trip you up if you go looking: the pack's own README describes this same conversion under the name "Mask List to Masks" in its Detailer nodes section. The class and its current display name - "Mask List to Mask Batch" - line up with that description; the pack has just moved on to a clearer name since the README text was written.)
When you actually need this
If you've been working in list mode - say, after SEGSToMaskList split a detection batch into individually-processed masks so you could run per-item logic on each one - and you now want to hand them all at once to something that expects a single batched MASK tensor instead of an iterator, this is the seam between those two worlds. Without it, you're stuck in list execution for everything downstream, which is sometimes exactly what you want and sometimes not - this node is how you opt back out.
The input and output
mask(MASK) - the mask list to convert. Feeding it a single plain mask also works fine; a lone mask is just a degenerate list of one, and you get a batch of one back.
Output is a single MASK, in batch form (is_list: false in the node's own schema, as opposed to the list-flagged output you'd get from something like Make Mask List).
Installing it
No separate install - comes bundled with the pack. Via ComfyUI Manager: search ComfyUI Impact Pack, Install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack
cd ComfyUI-Impact-Pack
pip install -r requirements.txt
(portable: python_embeded\python.exe -m pip install -r requirements.txt), restart. No models needed - pure tensor reshaping.
Common issues
Shape errors when stacking. A batch is one tensor, which means every item needs consistent dimensions. If the masks in your list came from differently-sized crops or regions - which is common right after per-element SEGS processing, where each detected region can be a different size - stacking them into a batch can fail or behave unexpectedly. Resize to a consistent size before converting if your list masks don't already match.
Confusing the direction. This converts list → batch specifically. If you actually have a batch and want to go the other way - split it back into a list for per-item processing - that's a different, separate conversion node; running this one on an already-batched mask won't do what you want. If a downstream node's behavior looks off after inserting this (skipping the per-item looping you expected, say), double-check you actually needed the batch and not the list in the first place.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |