🎈List-Mask-Splitter
Grab the masks you actually need from a mask batch
- masks
- masks
The mask twin of ImageListSplitter, and it does exactly what you'd guess: takes a MASK input and a comma-separated index string, and returns the masks you asked for as a list. Segmentation or inpainting runs often produce more masks than you want - a detector fires on five faces and you only care about two - and this is the least-friction way to thin the herd before it reaches your inpaint node.
It ships in Comfyui-LG_GroupExecutor, LAOGOU-666's small utility pack. Same deal as the image version: dependency-free, no models, and handy if you already have the pack installed for the group-execution features.
How it works
Identical logic to the image splitter, minus a channel dimension. indices splits on commas and parses ints. Input can be:
- A single batched mask tensor
[B, H, W]- indices pick from the batch. - A list of masks - indices pick from the list.
Outputs are [1, H, W] tensors in the order you listed them. Out-of-range indices are logged and skipped; nothing valid in the request means an empty MASK list comes back.
Inputs & outputs
- masks (MASK) - batch or list in.
- indices (STRING) - e.g.
0,2,4.
Output: masks (MASK list).
Install
cd ComfyUI/custom_nodes
git clone https://github.com/LAOGOU-666/Comfyui-LG_GroupExecutor
or ComfyUI Manager → "Comfyui-LG_GroupExecutor", then restart.
Small print
- Same ordering rules as the image version:
3,0,1reorders,2,2,2duplicates. - A 2D
[H, W]mask inside a list gets unsqueezed to[1, H, W]; anything with an unexpected shape is skipped with a warning. - Index parse errors (letters or malformed separators) log and return an empty list - check your string if a mask suddenly vanishes downstream.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| masks | MASK | — | |
| indices | STRING | 输入要提取的遮罩索引,用逗号分隔,如:0,1,3,4 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| masks | MASK | — |