Nodes/ComfyUI-fastblend/Mask List cap toBatch
ComfyUI Node

Mask List cap toBatch

Cap how many masks you pull, then flatten to a batch

By AInseven·Created 3 years ago·Updated 2 years ago· 228
Mask List cap toBatch
  • mask
  • MASK
load_cap-1

This is a small, single-purpose plumbing node, and the name basically tells you what it does if you break it apart: it takes a mask list, optionally caps how many of them you use, and converts what's left to a batch. It's the mask-flavored sibling of the pack's other list/batch utilities (Merge_Image_List does the same job for images), and it adds one extra convenience the image version doesn't have - a hard limit on how many list items get pulled before batching.

Like a couple of the smaller nodes in this pack, it isn't called out by name in the README's "here's what's worth knowing" section - the author explicitly says the nodes not mentioned there "don't have much use," so treat this as a minor utility rather than a headline feature, useful when you need it and otherwise easy to ignore.

How it works

A mask list - say, one mask per frame of video, coming out of a batch mask detector run as a list - gets truncated to at most load_cap items (if you've set one), then stacked into a single batch tensor. That combination of "trim, then flatten" is the whole node in one sentence.

The inputs and outputs that matter

  • mask (MASK) - the list of masks coming in.
  • load_cap (INT, optional, default -1) - how many items to keep before batching. -1 means no cap: take everything in the list. This follows the same convention you'll see in other ComfyUI list-loading nodes (VideoHelperSuite's "Load Cap" widgets, for one) where -1 is shorthand for "unlimited." Set it to a positive number when you only want, say, the first 30 frames of masks - a quick test run, or a deliberate trim to a specific frame range without having to change every other node's frame count upstream.
  • Output: MASK, as a single batch (is_list: false) - ready for anything downstream that expects one stacked mask tensor rather than a list to iterate.

How to install it

Ships in the same pack as SmoothVideo and the rest. Via ComfyUI Manager: search "ComfyUI-fastblend," install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/AInseven/ComfyUI-fastblend

Restart ComfyUI. No models, no extra Python dependencies beyond the pack itself - it's a pure data-shaping node.

Common issues & troubleshooting

You get fewer masks than you expected. Check load_cap first - if it's set to a positive number left over from a test run, it'll silently truncate your list every time, which is easy to forget about once your workflow's saved and reused.

A downstream node wants a list, not a batch. This node's whole job is converting list → batch, so if something further down the graph expects to iterate a list, this node is the wrong tool at that point in the chain - you want it right before whatever needs one combined mask tensor, not earlier.

Mismatched counts between your mask batch and your image batch. If you've capped the mask list here but didn't apply the same cap to your corresponding image sequence upstream, you'll end up with a mask batch and an image batch of different lengths, which will error or misalign further down. Keep the cap consistent across both.

CategoryAInseven

Inputs (2)

NameTypeDefaultDescription
maskMASK
load_capoptINT-1

Outputs (1)

NameTypeDescription
MASKMASK