Nodes/ComfyUI 1hewNodes/Mask Batch to List
ComfyUI Node

Mask Batch to List

Un-batch your masks — one batch in, a list of individual masks out

By 1hew·Created about a year ago·Updated 7 days ago· 33
Mask Batch to List
  • mask_batch
  • mask_list

This is a plumbing node, and it earns its keep purely by existing. ComfyUI has two ways of carrying multiple things around: a batch (one tensor with a leading dimension) and a list (an actual Python list, where each element is a separate tensor). They're not interchangeable - a node that processes one image at a time wants a list item, not a batch slice, and list-aware routing is how you do "do something to each mask individually" without a manual batch-splitting tangle.

This node converts a mask batch into a mask list. That's the entire job, and it's the conversion sibling of the pack's Image Batch to List.

How it works

One input, one output: mask_batch in, mask_list out. Each frame of the batch becomes its own single-mask element in the list, in order. Nothing is resized, reordered, or interpreted - it's a pure reshape of how the masks are carried.

The is_list flag on the output is the important part: downstream nodes that understand list types will now see a list and can iterate over it, running per-mask operations (a mask-paste, a per-mask crop, a stroke per region) one element at a time. If the input batch is empty, you get an empty list rather than an error, so loops that branch on "did anything come through" stay clean.

Where you'd use it

Whenever a downstream step wants masks one at a time. Example: you have a batch of region masks from a detection pass and you want to paste each region's cutout back onto the canvas with different parameters per mask - a list lets you route each mask through its own per-item handling. It also composes with the pack's own conversion group, which has the matching Mask List to Batch node for the reverse direction, so you can flip between batch and list as the graph demands without losing anything.

Installing it

Part of 1hewNodes. ComfyUI Manager → search "ComfyUI 1hewNodes" → install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes

Restart ComfyUI. No special dependencies, no model downloads.

Common issues

The confusion is always about which direction you need. If a node refuses your mask and expects a batch, you've gone the wrong way - batch→list is only for list-expecting consumers. Also remember list order mirrors batch order, so if you rearranged the batch upstream, the list inherits that arrangement. And a subtle one: lists of masks can hold masks of different sizes, whereas a batch can't - so once you go list, size normalization is your responsibility if you plan to batch back up later. If that's the plan, keep sizes consistent or use the pack's multi-mask batch builder to re-normalize on the way back.

Category1hewNodes/conversion

Inputs (1)

NameTypeDefaultDescription
mask_batchMASK

Outputs (1)

NameTypeDescription
mask_listMASK