Nodes/ComfyUI-BCNodes/Repeat Mask Batch
ComfyUI Node

Repeat Mask Batch

Repeat Mask Batch

By 0xBeycan·Created about a month ago·Updated 13 days ago· 2
Repeat Mask Batch
  • mask
  • mask
◄amount1►

This is a one-trick node, and the trick is one you need about once a week: making a mask batch the same length as your image batch.

What it is

Give it a MASK and an amount, get the whole batch back repeated that many times, in order - m0 m1 m0 m1 …, all the way to the end. It's the mask-side twin of ComfyUI's own Repeat Image Batch, and it behaves the same way: one allocation, and amount = 1 hands the input straight through without even copying it.

Two inputs, in the schema and in reality:

  • mask
  • amount - 1 to 4096, default 1

One output, mask.

When you reach for it

The classic case is a still-image workflow promoted to video. You painted or detected a single mask for a subject that doesn't move, and now the batch is 33 frames. Core's compositing nodes want matching batch lengths, so every frame downstream gets the same mask, and you're done.

The other case is the reverse: you have a short cycle of masks (say, an alternating two-frame pattern) and you want it tiled across a longer clip. amount repeats the whole batch rather than each frame, so a two-mask batch with amount = 8 gives you sixteen frames in the same m0 m1 m0 m1 rhythm.

Notably, if you're using the pack's Draw Mask On Image, you don't need this at all - that node already repeats fewer masks than frames in order. This one is for when the consumer is something stricter, like a masked sampling node or a third-party inpainting pipeline that validates shapes.

Install

Pack install, same as its siblings. In ComfyUI Manager search ComfyUI-BCNodes, or:

cd ComfyUI/custom_nodes
git clone https://github.com/0xBeycan/ComfyUI-BCNodes
pip install -r ComfyUI-BCNodes/requirements.txt

Restart, then search BCNodes in the node library. The requirements pull in opencv-python, postfx and caption-audit; only the last two matter to the PostFx and Caption Audit nodes, so this one loads regardless. If you have an old ComfyUI-AutoBypass folder lying around from the pack's previous name, delete it.

Where it bites

The repeat is a real copy, not a view. amount is allowed up to 4096, and nobody's validating whether the result fits: repeating a single 1080p float32 mask 500 times is about 4 GB. On a batch of masks it multiplies by both factors. Reach for amount in the low tens, not the thousands.

And a missing or empty mask doesn't complain - you get a (1, 64, 64) zero mask back. That's convenient in a half-built graph and confusing in a finished one, because the symptom (nothing gets inpainted) looks like a sampler problem rather than an upstream one.

CategoryBCNodes/mask

Inputs (2)

NameTypeDefaultDescription
maskMASK—
amountINT11–4096—

Outputs (1)

NameTypeDescription
maskMASK—