Nodes/ComfyUI Impact Pack/Make Mask Batch
ComfyUI Node Runs on cloud

Make Mask Batch

Stack separate masks into one batch tensor

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,242
Make Mask Batch
  • mask1
  • MASK

You've got two or three masks sitting around - separately generated, separately painted, whatever - and a downstream node that wants one MASK batch instead of several loose ones. This node stacks them.

Batch vs list, and why it matters which one you pick

Impact Pack gives you two ways to combine multiple masks: batch and list, and they're not interchangeable in how ComfyUI treats them. A batch is one tensor with a batch dimension - a node that consumes it runs once, over all the masks at the same time, vectorized. A list is ComfyUI's list-execution mode - a node that consumes it runs once per item, looping. Make Mask Batch is the batch one. There's a sibling, Make Mask List, that produces the list version instead - pick based on what the node downstream actually wants, since wiring the wrong shape in is one of the more confusing type errors to debug from the message alone.

Reach for batch when you want a single pass over all the masks together (say, feeding a Detailer that processes a batch of regions in one go). Reach for list when you specifically need per-item behavior - different handling per mask, or feeding something that's designed to loop.

The input and output

The schema shows one required-looking slot, mask1 (MASK), but it's optional and that's deliberate - the node grows more slots as you connect them, the same pattern the pack uses for Make Image Batch, whose README description explicitly notes the input list "can be scaled up as needed." Connect one mask and you get a batch of one; connect several and they stack into a single batch tensor.

Output is a single MASK, batched.

Installing it

Bundled with the pack, no extra step. Via ComfyUI Manager: search ComfyUI Impact Pack, Install, restart. By hand:

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. Pure tensor plumbing - no models, no heavy dependencies.

Common issues

If masks come from crops or regions of different sizes, stacking them into one batch tensor can be fussy - a batch by definition needs consistent dimensions across its items. If you're combining masks pulled from different source images or different crop sizes, resize them to match before feeding this node, rather than assuming it'll sort dimension mismatches out for you.

The more common mistake, though, is reaching for this node when you actually wanted the list version, or vice versa. If a downstream node errors on the type of your combined mask, or a batch-consuming node only seems to process the first item, double-check you didn't accidentally wire in a list where a batch was expected (or the reverse) - the pack has both Masks to Mask List and Mask List to Masks-style converters if you need to switch between the two after the fact rather than rebuilding from scratch.

CategoryImpactPack/Util

Inputs (1)

NameTypeDefaultDescription
mask1optMASK

Outputs (1)

NameTypeDescription
MASKMASK