Nodes/was-node-suite-comfyui/Masks Combine Batch
ComfyUI Node Runs on cloud

Masks Combine Batch

Flatten a batch of masks into one

By WASasquatch·Created 3 years ago·Updated about a year ago· 1,812
Masks Combine Batch

      Masks Combine Batch takes a batch of masks and merges them into a single mask. The README puts it in one line - "combine batched masks into one mask." Where a lot of nodes hand you a stack of masks (one per detected object, one per frame, one per region), this collapses that stack into one flat mask that covers everywhere any of them did.

      Where this comes up

      Plenty of detection and segmentation nodes output masks as a batch - think a segmenter that finds every person in a frame and returns one mask per person, or a node that produces a mask for each item in a grid. Sometimes you want them separate. Often you don't: you want "everywhere a person is," as one region, to feed into a single inpaint or a single composite. That's this node. It turns N masks into the union of all of them.

      It pairs naturally with the rest of WAS's mask toolkit. A common shape: generate a batch of masks upstream, combine them here into one, then dilate or smooth the edge before handing it to a Set Latent Noise Mask. Our inpainting notes make the general point that getting the mask right - clean, unified, correctly feathered - is most of what separates a convincing edit from a blotchy one, and batch-combining is one of the small steps that keeps that tidy.

      Combine Batch vs Combine Masks - don't mix them up

      WAS has two similarly named nodes and they solve different problems:

      • Masks Combine Batch (this one) - one input that is a batch of masks, flattened into one.
      • Masks Combine Masks - several separate mask inputs (2 or more), combined into one.

      If your masks arrive as a single batched tensor, use this. If they arrive as distinct wires you want to merge, use the other. Feeding a batch into the discrete-input node (or vice versa) is the usual reason someone's combine "does nothing."

      How it works

      The input is a batch of masks; the output is a single MASK that's the union across the batch - any pixel selected in any member is selected in the result. That output goes to whatever consumes a mask: an inpaint noise mask, a paste, a mask-to-image, or a further region operation.

      Installing it

      Comes with WAS Node Suite. Install the pack via ComfyUI Manager (search was-node-suite-comfyui, install, restart) or clone it:

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

      install requirements.txt, restart. No models for the mask nodes.

      Troubleshooting

      Two things to check when a combine "isn't working": first, that you're using the batch node for batched input (see above); second, the pack-wide issue. WAS Node Suite has been unmaintained since December 2023, and the whole suite can throw "Import Failed" after a ComfyUI update from a pinned-dependency clash (opencv is the usual one). Reinstall requirements.txt into the correct venv (activate it, or use install.bat) and the mask family loads again.

      Categoryx

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs