Nodes/ComfyUI-Apt_Preset/type_Mask_List2Batch
ComfyUI Node

type_Mask_List2Batch

Stack loose masks into one batched MASK

By cardenluo·Created 2 years ago·Updated a day ago· 324
type_Mask_List2Batch
  • mask
  • MASK

type_Mask_List2Batch is the ImageBatch equivalent for masks: it takes masks and stacks them into a single batched MASK tensor. If you've ever had a node hand you masks one at a time - per frame from a video pipeline, per region from a detector - and then watched the inpaint or conditioning node downstream refuse them because it wants one batched tensor, this is the fix.

This matters more than it sounds. ComfyUI's convention is that a MASK socket can carry a batch of masks internally (N×H×W), and most serious consumers expect that: inpainting setups, ControlNet conditioning, VAE-side masking, the whole "masked regional resample" pattern that packs like Impact Pack lean on for FaceDetailer-style detail passes. If your producer emits one mask per image instead, you have loose pieces and nowhere clean to plug them. This node is the bundle step.

How it works

Feed a mask (or masks) into the mask input and it stacks them along the batch dimension, emitting a single MASK that downstream nodes treat as one unit. Mechanically it's concatenation over the batch axis - the same operation ImageBatch does for images, just on the 0–1 mask tensors. The output behaves like any normal batched mask: you can feed it straight into a VAE encode, an inpaint node, or a mask-compositing step, and ComfyUI applies it across all entries.

Where this shows up in practice with this pack: the Apt pack is video-heavy (Wan, LTX, AnimateDiff control stacks), and video work produces masks per frame. You also hit it in multi-region workflows where each region detector gives you its own mask. Either way, one node turns scattered masks into something the rest of the graph can actually use.

The inputs and outputs that matter

  • mask - the required input. Wire in your mask or mask list.
  • MASK - the output, a single batched mask.

That's it. One in, one out. There's no opacity slider, no blend mode, no widget to fiddle with - it's pure bundling, which is exactly what a node like this should be.

How to install it

It comes with the ComfyUI-Apt_Preset pack. Either search "ComfyUI-Apt_Preset" in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset

then run install.bat (or pip install -r requirements.txt) and restart ComfyUI. No model files needed for this node - the pack's Apt_File segmentation resources are only for its face/clothes/body segment nodes, not for anything in this data/batch category.

Common issues & troubleshooting

The usual first gotcha: if your source node outputs masks with different resolutions, stacking can produce a shape mismatch. Normalize your masks to the same size before this node - a quick resize or the pack's own mask-utility nodes will sort it. It's the same rule you already know from ImageBatch.

And the pack-level reminder, because it bites people: the pack is by a Bilibili-based author, the README is a Chinese-to-English translation, and its install is less forgiving than a one-click Manager install. The single most reported problem in the community is an IMPORT FAILED for the whole pack - that's the dependency step. Run install.bat, restart ComfyUI, and verify the node appears in your node list before you blame the workflow.

CategoryApt_Preset/data/list|Batch

Inputs (1)

NameTypeDefaultDescription
maskMASK

Outputs (1)

NameTypeDescription
MASKMASK