Nodes/ComfyUI-Practical-Tools/Mask Batch to Mask List
ComfyUI Node

Mask Batch to Mask List

Break a mask batch into individual masks — Mask Batch to Mask List

By wenchengxiang·Created about a month ago·Updated a day ago· 1
Mask Batch to Mask List
  • 遮罩
  • 遮罩

Some nodes want a batch of masks. Others want a list - one mask at a time, on separate wires, so you can process each individually. wcx_MaskBatchToMaskList is the converter between those two worlds: it takes a single MASK batch and splits it into a Python list of individual masks on the output side.

It's the front half of a pair with this pack's Mask List to Mask Batch, and the direction matters because of how ComfyUI distinguishes the two shapes. A batch is one tensor with a batch dimension - efficient, but you treat all frames the same. A list is a Python list where each element arrives as its own value, which is what list-aware nodes expect when they want to do per-element work (think a loop that blurs each mask, or a node that takes several masks as separate inputs). This node marks its output with OUTPUT_IS_LIST, which is the engine flag that tells ComfyUI to treat each element as a distinct value rather than one tensor.

Input is a single optional mask socket (labeled 遮罩 in the UI - a Chinese label, harmless once you know it), and the output is masks as a list. Two practical details worth knowing:

  • It's lenient about empty input. If you feed nothing, it returns a list containing one empty 64×64 mask rather than erroring. That's a deliberate "keep the graph alive" choice.
  • Each element keeps its own batch dimension. Every mask in the list is re-shaped to be at least 3D before it goes out, so list consumers get well-formed masks to work with.

The natural companion is wcx_MaskListToMaskBatch for the return trip, and the reason to bother with either is that batch-vs-list is a real compatibility boundary in ComfyUI - plenty of good packs are one or the other, and this node is the adapter that lets them talk.

Gotchas:

  • It splits, it doesn't duplicate. A 12-frame batch becomes a 12-element list. If you needed to repeat masks across a longer sequence, that's a different node.
  • List output may not preview the way a batch does. Downstream nodes that expect a batched tensor will choke on a list - which is exactly when you want the inverse node to convert back.

Standard light install:

# ComfyUI Manager: search "ComfyUI-Practical-Tools" → Install → restart

# or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/wenchengxiang/ComfyUI-Practical-Tools
# restart ComfyUI

It's a quiet adapter node, but if you've ever been stuck with a batch of masks on one side and a list-only consumer on the other, you know these little bridges are half the reason ComfyUI workflows work at all.

CategoryPractical-Tools/Mask

Inputs (1)

NameTypeDefaultDescription
遮罩optMASK

Outputs (1)

NameTypeDescription
遮罩MASK