Mask to List (RMBG)
Bundle several masks into one list output
- mask_1
- mask_2
- mask_3
- mask_4
- mask_5
- mask_6
- MASK
You ran a segmentation pass and now you've got a fistful of separate masks - one for the hair, one for the jacket, one for the bag - sitting on different sockets. Mask to List gathers up to six of them and hands you a single output that a list-aware node can chew through one at a time. That's the whole job. It's plumbing, not magic, and in a background-removal pack that's exactly what you end up needing.
Here's the context. The RMBG pack is the fat one - it bundles BiRefNet, InSPyReNet, BEN2, SDMatte, SAM/SAM2/SAM3 and GroundingDINO behind one set of nodes. The models that select specific things (clothes segmentation, face parsing, text-prompted SAM) don't give you one clean foreground mask; they give you a pile of per-category or per-object masks. Once you've got a pile, you usually want to process each one identically - combine, blur, invert, feed to inpaint. Doing that six times by hand is silly. Bundle them into a list and let ComfyUI loop.
How it works
The important thing to understand is what a "list" means in ComfyUI, because it trips up everyone once. A batch is a single tensor with several images stacked inside it - one thing moving through the graph. A list is several separate items, and when you feed a list into a downstream node, ComfyUI runs that node once per item automatically. Mask to List produces the list kind (its output is flagged as a list), so whatever you wire it into fires repeatedly, once for each mask you connected. That's the behavior you're buying.
The one wrinkle is size. Masks from different sources won't always share dimensions, and some downstream nodes get unhappy about that. resize_mode is the escape hatch.
The inputs and outputs that matter
resize_mode(off/crop/fit, defaultoff) - how to reconcile masks of different sizes.offleaves every mask exactly as it came in, which is fine when they already match.cropandfitnormalize them to a common size - reach for one of these the moment a downstream node complains about mismatched shapes.mask_1throughmask_6(all optionalMASKinputs) - connect as many as you have, from one to six. They're optional, so leaving sockets empty is fine; it just collects whatever's plugged in.
The single output is MASK, but it's a list of masks, not one merged mask. Wire it into a node you want to run per-mask - a mask combiner, a blur, an extractor, an inpaint pass. If your goal was instead to merge several masks into one union, that's a different node (a mask combiner); this one keeps them separate and just packages them for iteration.
How to install it
Same as the rest of the pack - this node ships inside ComfyUI-RMBG, there's nothing to download on its own.
- ComfyUI Manager: search
Comfyui-RMBG, install, restart. - Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/1038lab/ComfyUI-RMBG, then install the requirements with./ComfyUI/python_embeded/python -m pip install -r requirements.txt(use the embedded Python if the system one won't cooperate), and restart.
Worth knowing before you commit: Mask to List itself needs no model weights and no GPU, but pulling in the pack for one plumbing node drags along its full dependency list - onnxruntime, groundingdino-py, segment-anything and friends. On a Windows desktop install, if things crash right after installing requirements, set PYTHONUTF8=1 first and retry; that's the pack's documented gotcha.
Common issues
The usual snag is a downstream node erroring on mismatched mask sizes - flip resize_mode from off to crop or fit and it goes away. The other one is conceptual: if a node downstream runs six times when you expected it to run once, that's not a bug, that's the list doing its job. If you actually wanted a single combined mask, you reached for the wrong tool - you want a mask combiner, not this. And there's no seventh socket; if you routinely juggle more than six masks, this node caps out and you'll need to chain or rethink the graph.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| resize_mode | COMBO | off | 3 options: off, crop, fit |
| mask_1opt | MASK | — | |
| mask_2opt | MASK | — | |
| mask_3opt | MASK | — | |
| mask_4opt | MASK | — | |
| mask_5opt | MASK | — | |
| mask_6opt | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |