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

Mask List to Mask Batch

Turn several mask wires back into one batch — Mask List to Mask Batch

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

The reverse trip of Mask Batch to Mask List: instead of one batch split into individual masks, this node takes a list of masks - each arriving on its own wire - and fuses them into a single batched MASK tensor. It's the adapter that lets list-shaped mask pipelines feed batch-shaped consumers, and it's the more forgiving of the pair, because it actively fixes one of the two classic list problems.

The key mechanic is INPUT_IS_LIST: the single input socket accepts multiple wires, each carrying one mask, and the node receives them as a Python list. It then concatenates them into one batch. The forgiving part is what happens when the masks aren't the same resolution - the most common real-world mess when masks come from different sources. Every mask that doesn't match the first mask's dimensions gets upscaled (Lanczos) to match. So where the strict MaskBatch node in this pack will error on mismatched dimensions, this one quietly conforms everything to the first mask's size.

Input is a single mask socket (labeled 遮罩 in the UI - this pack's Chinese port label), which you can wire with multiple connections. Output is masks as a batched tensor. If you feed nothing at all, it returns a single empty 64×64 mask rather than crashing.

Where you'd reach for it:

  • After a per-mask processing step. Say you blurred or grew several masks individually (each on its own wire) and now need them back as a batch for the next stage. This is the join.
  • Mixing masks from different sources. Because it resizes, it tolerates the exact situation that trips up strict joiners - masks of different sizes coming from different detectors or models.
  • Feeding batch-oriented detailing loops. Once they're in one tensor, the whole batch goes through the same downstream pass.

Gotchas:

  • The first mask is the referee. The resize target is the first mask in the list; every other mask gets conformed to it. If your "source of truth" mask isn't first, you may get the wrong sizes winning.
  • Resizing is silent. Mismatched masks get Lanczos-scaled with no warning, which can subtly distort a detailed mask. For pixel-perfect work, get your masks to a common size before you join them.
  • Empty input produces a dummy mask, not an error. That's lenient, but a 64×64 blank flying through can surprise you downstream. Check your wiring if you see an unexpected empty frame.

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

Used back-to-back with Mask Batch to Mask List, this pair is the complete bridge between the two mask shapes in ComfyUI - and this direction is the one that bails you out when the shapes don't even match.

CategoryPractical-Tools/Mask

Inputs (1)

NameTypeDefaultDescription
遮罩MASK

Outputs (1)

NameTypeDescription
遮罩MASK