ComfyUI Node Runs on cloud

Mask Batch

Stack separate masks into one batched MASK

By WASasquatch·Created 3 years ago·Updated about 17 hours ago· 1,840
Mask Batch
  • masks_a
  • masks_b
  • masks_c
  • masks_d
  • masks_e
  • masks_f
  • masks_g
  • masks_h
  • masks_i
  • masks_j
  • masks_k
  • masks_l
  • masks_m
  • masks_n
  • masks_o
  • masks_p
  • masks_q
  • masks_r
  • masks_s
  • masks_t
  • masks_u
  • masks_v
  • masks_w
  • masks_x
  • masks_y
  • masks_z
  • masks
  • count

Don't confuse this with Mask Batch to Mask, WAS's other batch-related node - that one pulls a single mask out of a batch by index. This one, plain Mask Batch, does the opposite job: it takes separate individual masks and stacks them into one batched MASK tensor, the same way ComfyUI's own core Image Batch node combines two images into a batch dimension instead of two independent wires. WAS's brief for this node doesn't spell out an exact field list the way its README does for some siblings, so that's the naming-convention reading I'm going on - "X Batch" builds a batch, "X Batch to Y" un-builds one - and it lines up with how the rest of ComfyUI uses the word.

Why you'd want a batched mask instead of separate wires

Batching exists so a pipeline can process several things in one pass instead of looping node-by-node. If you're running an inpaint, a masked filter, or a composite across several frames or several candidate crops, a lot of the downstream nodes are much happier consuming one batched MASK that lines up with a batched IMAGE than they are juggling four separate mask wires that all need to stay in sync by hand. Mask Batch is the node that turns "I have several masks" into "I have one mask batch," so the rest of your graph can treat them as a single unit.

How it works

Functionally it's a stacking operation: feed it individual mask tensors and it concatenates them along the batch dimension, handing back one MASK output whose batch size equals however many you fed in. It doesn't blend, merge, or combine the masks' contents the way WAS's dedicated "combine" nodes do (Masks Combine Masks, Masks Combine Batch) - those collapse multiple masks into one shared mask. Mask Batch keeps every mask distinct; it just changes how they travel through the graph, from several wires to one batched tensor.

The inputs and outputs that matter

Individual MASK inputs going in, one batched MASK coming out. If your goal is actually merging the masks' white regions together into a single combined mask, this isn't that node - look at WAS's Combine nodes instead. Mask Batch is strictly about packaging, not blending.

Installing it

ComfyUI Manager: search "WAS Node Suite," install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui

install requirements.txt against your ComfyUI Python, restart. No model, no external dependency of its own - it's tensor plumbing.

Common issues & troubleshooting

Batch size mismatch downstream. The classic ComfyUI batching complaint: if your batched mask's count doesn't match your batched image's count, whatever consumes both together will error or silently misalign entries. Check that whatever fed you the individual masks is producing the same count as the images they're meant to pair with.

I wanted them merged, not stacked. That's the combine family, not this node - Mask Batch keeps each mask separate inside the batch dimension rather than blending them into one.

Every WAS node disappeared at once. Pack-level, not this node. WAS Node Suite has been unmaintained since the author marked it retired in December 2023, and the recurring issue since is the whole suite throwing "Import Failed" after a ComfyUI update when a pinned shared dependency gets bumped underneath it. Reinstall requirements against the correct, embedded Python interpreter (or run install.bat) to bring it back.

CategoryWAS Suite/Image/Masking

Inputs (26)

NameTypeDefaultDescription
masks_aoptMASKFirst mask or batch. Every connected slot has to be the same size, and at least one slot must be connected.
masks_boptMASKMask 2, joined on after the one before it. Unconnected is skipped.
masks_coptMASKMask 3, joined on after the one before it. Unconnected is skipped.
masks_doptMASKMask 4, joined on after the one before it. Unconnected is skipped.
masks_eoptMASKMask 5, joined on after the one before it. Unconnected is skipped.
masks_foptMASKMask 6, joined on after the one before it. Unconnected is skipped.
masks_goptMASKMask 7, joined on after the one before it. Unconnected is skipped.
masks_hoptMASKMask 8, joined on after the one before it. Unconnected is skipped.
masks_ioptMASKMask 9, joined on after the one before it. Unconnected is skipped.
masks_joptMASKMask 10, joined on after the one before it. Unconnected is skipped.
masks_koptMASKMask 11, joined on after the one before it. Unconnected is skipped.
masks_loptMASKMask 12, joined on after the one before it. Unconnected is skipped.
masks_moptMASKMask 13, joined on after the one before it. Unconnected is skipped.
masks_noptMASKMask 14, joined on after the one before it. Unconnected is skipped.
masks_ooptMASKMask 15, joined on after the one before it. Unconnected is skipped.
masks_poptMASKMask 16, joined on after the one before it. Unconnected is skipped.
masks_qoptMASKMask 17, joined on after the one before it. Unconnected is skipped.
masks_roptMASKMask 18, joined on after the one before it. Unconnected is skipped.
masks_soptMASKMask 19, joined on after the one before it. Unconnected is skipped.
masks_toptMASKMask 20, joined on after the one before it. Unconnected is skipped.
masks_uoptMASKMask 21, joined on after the one before it. Unconnected is skipped.
masks_voptMASKMask 22, joined on after the one before it. Unconnected is skipped.
masks_woptMASKMask 23, joined on after the one before it. Unconnected is skipped.
masks_xoptMASKMask 24, joined on after the one before it. Unconnected is skipped.
masks_yoptMASKMask 25, joined on after the one before it. Unconnected is skipped.
masks_zoptMASKMask 26, the last slot. Unconnected is skipped.

Outputs (2)

NameTypeDescription
masksMASKEvery connected mask as one batch, in slot order, so a node downstream processes all of them in one run.
countINTHow many frames the batch holds, which is the total across the slots rather than the number of slots.