Mask Batch to Mask
Pull one mask out of a batch
- masks
- MASK
Some nodes hand you a batch of masks when you only want one. A segmenter that returns several candidate regions, a batch of frames each with its own mask, a multi-output masking step - you end up holding a MASK batch and the node downstream wants a single MASK. Mask Batch to Mask is the little adapter that fixes that: it returns one mask out of a batch, by index.
It's plumbing, plain and simple. But it's the kind of plumbing that unblocks a graph that would otherwise throw a shape error because a batch went somewhere a single mask was expected.
How it works
The README description is the whole thing: "Return a single mask from a batch of masks." You give it a mask batch and tell it which one you want (an index into the batch), and it pops that single mask out. Index 0 is the first mask, 1 the second, and so on.
This is the mask-world equivalent of grabbing one image out of an image batch. It doesn't combine or merge the masks - for that WAS has separate "combine" nodes - it just selects one.
Inputs and outputs that matter
The inputs are the MASK batch and the index of the one you want. The output is a single MASK, ready to feed an inpaint, a composite, or an Image Blend by Mask.
If your goal is the opposite - squashing several masks into one combined mask - this isn't it. Look at Masks Combine Masks or Masks Combine Batch in the same pack. Batch-to-Mask is strictly a pick one operation.
How to install it
ComfyUI Manager: search was-node-suite-comfyui, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui
then install the pack's requirements.txt in your ComfyUI venv and restart. No downloads - it's tensor indexing.
Common issues & troubleshooting
I get the wrong mask / an out-of-range error. Indexing starts at 0. If your batch has four masks, valid indices are 0–3; asking for index 4 runs off the end. Count from zero.
It only ever returns one mask and I wanted to process all of them. By design - this node picks a single mask. If you need to run every mask in the batch through the same downstream logic, that's a batching/loop problem, not what this node solves. Either handle the batch as a batch downstream or select and process them one index at a time.
Select vs combine confusion. This selects one mask. If your composite looks wrong because you expected all the regions merged, you wanted a combine node instead. Batch-to-Mask throws away the masks you didn't pick.
The picked mask has holes or ragged edges. That's the mask's own quality, not the selection. Clean it after picking - Mask Fill Holes for interior gaps, smooth/dilate for edges - before you use it.
Whole pack won't import after a ComfyUI update. The recurring WAS Node Suite issue - package downgrades colliding with a ComfyUI bump. Re-run the pack's requirements against the activated venv, or install.bat. Maintenance-only since late 2023.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| masks | MASK | The batch of masks to take one mask out of. A single unbatched mask counts as a batch of one, so index 0 returns it as it is. | |
| index | INT | 00–16384 | Which mask to take, counting from zero: 0 is the first mask, 1 the second. An index past the end of the batch returns the last mask and prints the index and the batch length to the console, rather than failing the prompt, so a sequence that came back shorter than expected still produces a mask. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | The one mask selected from the batch, no longer batched. |