Mask Batch Split
Split your mask batch the same way you split the images
- mask
- mask_1
- mask_2
Here's the thing about splitting an image batch: the moment you do it, your mask batch is now the wrong size. If you split 40 frames into 8 and 32, but leave your masks as one 40-frame tensor, every downstream image+mask operation falls apart. Mask Batch Split is the sibling of the pack's Image Batch Split, built so your masks can follow your images through the split without you hand-crafting index ranges.
It does one thing: splits a mask batch into two parts, mask_1 and mask_2, at a take_count you choose, from either the start or the end. Same shape as its image counterpart, which is the entire point - run them side by side with matching parameters and your image/mask pairs stay aligned.
How it works
- take_count - frames in the "taken" part (1–1024, default 8).
- from_start -
trueputs the firsttake_countinmask_1(rest inmask_2);falseputs the lasttake_countinmask_2(everything before it inmask_1).
Edge handling matches the image node exactly: when take_count >= batch_size, one output is the full batch and the other is an empty tensor with the same dtype and shape semantics, so downstream nodes don't crash. Slicing runs in a worker thread to keep the UI responsive.
Inputs: mask, take_count, from_start. Outputs: mask_1, mask_2.
Install
Part of ComfyUI-1hewNodes:
cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes
Restart ComfyUI. No models, no downloads. Needs a current ComfyUI (the pack uses the v3 node API).
Where it fits
The rule of thumb: wherever you drop Image Batch Split, drop Mask Batch Split next to it with identical take_count and from_start. That keeps every image and its mask in lockstep through the split. It's the difference between a graph that silently misaligns masks after frame 8 and one that just works.
Common issues
- Masks no longer match your images - the classic mistake is splitting images with
from_start=trueand masks withfrom_start=false, or using differenttake_count. Mirror the image node's settings exactly. - Empty mask output -
take_count >= batch_sizeyields an empty tensor by design. If a node downstream chokes, that's the cause; it's the documented edge case, not corruption.
That's the whole node. It's boring on purpose - its job is to make sure the interesting split you did to your images doesn't quietly break every mask that depends on them.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| take_count | INT | 81–1024 | — |
| from_start | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| mask_1 | MASK | — |
| mask_2 | MASK | — |