type_Mask_Batch2List
Turn a batch of masks into a list ComfyUI can loop over
- masks
- MASK
This is a small, unglamorous plumbing node, and it exists because ComfyUI treats "a batch of masks" and "a list of masks" as genuinely different things, not just two ways of saying the same data. type_Mask_Batch2List converts one into the other, and if you've ever wired a batch mask generator into a node that expected a list and gotten confusing behavior, this is the node that fixes it.
The distinction that matters. A batch in ComfyUI is a single tensor with multiple masks stacked along one dimension - the whole thing moves through your graph as one unit, and any node downstream that isn't specifically batch-aware processes it all together rather than one mask at a time. A list, on the other hand, is a Python-level sequence of separate items, and ComfyUI's execution engine automatically loops any node fed a list, running once per item and collecting the results. That auto-looping behavior is exactly what you want when you need per-mask processing - an inpaint composite that should treat each mask's region independently, for instance - but you only get it if the data arrives as a list, not a batch.
This node's whole job is that one conversion: take masks (a MASK batch) in, and hand back the same masks as a proper list output (the schema marks the output is_list: true), so anything downstream that relies on ComfyUI's list-looping behavior starts working correctly instead of silently treating your five masks as one blob.
Where you'd actually reach for this. Any pipeline where you generate multiple masks at once - say, from a segmentation node that returns one mask per detected region - and then need to run a per-mask operation afterward: separate inpaint passes per region, separate blur or expand settings per mask, or feeding each one individually into a node that only accepts a single mask at a time. Without this conversion step, you'd either need the batch-aware version of every downstream node (which doesn't always exist) or you'd end up processing all the masks identically whether that's what you wanted or not.
Output. MASK, marked as a list - same mask data as the input, restructured so ComfyUI's execution model treats each one as a separate item to loop over.
Installing it. Standard for the whole pack - search "ComfyUI-Apt_Preset" in ComfyUI Manager, or clone directly:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git
Run install.bat on Windows for dependencies, then restart ComfyUI. This is a pure data-structure conversion with no models or GPU dependency - it should work the instant the pack loads.
Troubleshooting. If downstream nodes still seem to be processing your masks as one unit after adding this node, double-check that the node actually consuming the list is one that's designed to accept and loop over list inputs - not every node handles a list input the way you'd expect, and some genuinely expect a batch and will just take the first item or error if handed a list instead. And if this node isn't showing up in your install at all, that points to the documented pack-wide IMPORT FAILED issue tied to a missing dependency elsewhere in Apt_Preset, not this specific node - check your ComfyUI console log at startup for the actual missing package and reinstall via Manager's "install missing custom nodes."
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| masks | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |