Repeat Masks π₯π ₯π π ’(RepeatMasks)
From a technical implementation perspective, this node receives a mask in PyTorch tensor format and processes it via torchγ
Repeat Masks
The Repeat Masks node is a tool for processing and expanding mask data. Its core function is to receive an input MASK and, based on a specified multiplier, repeat and concatenate it along the batch dimension, thereby generating a new mask sequence containing multiple identical copies of the original mask. This node primarily serves workflows that require batch or sequential processing of masks.
Node Functionality
From a technical implementation perspective, this node receives a mask in PyTorch tensor format and uses the torch.cat operation to repeat and concatenate it along dimension 0 (the batch dimension) a specified number of times. Both its input and output are of the standard ComfyUI MASK data type, ensuring compatibility with other nodes in the pipeline. The multiply_by parameter controls the number of repetitions, with a minimum value of 1 and a maximum value limited by the system-defined BIGMAX constant.
Node Parameter Description - Repeat Masks π₯π ₯π π ’
Connection Inputs (Inputs)
| Parameter Name | Data Type | Required | Default Value | Range/Options | Description |
|---|---|---|---|---|---|
mask | MASK | Yes | - | - | mask (input parameter): The original mask data to be repeated. Type is MASK. |
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Range/Options | Description |
|---|---|---|---|---|---|
multiply_by | INT | Yes | 1 | 1 - BIGMAX (Step: 1) | multiply_by (input parameter): Specifies the number of times the mask needs to be repeated. Valid range is 1 to BIGMAX, with a step of 1. |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| MASK | MASK | MASK (output parameter): Outputs the new mask sequence generated after repetition and concatenation. |
| count | INT | count (output parameter): Outputs the total number of masks contained in the new mask sequence (i.e., the repetition count). |
Usage Scenarios
This node is very useful in video generation or image batch processing workflows when you need to apply the same mask to a series of frames. For example, you can input a mask for foreground segmentation into this node, set multiply_by to the number of video frames, quickly generate a mask sequence applicable to all frames, and then feed it into subsequent video synthesis nodes.
Notes
Please note that this node only performs simple repetition and concatenation; it does not modify or interpolate the mask content itself. The output mask sequence is identical in content, only the batch size is increased. Setting the multiply_by parameter too high may lead to a significant increase in VRAM usage.
Repeat Masks π₯π ₯π π ’ Node Source Code Link
The Repeat Masks π₯π ₯π π ’ node is from the ComfyUI-VideoHelperSuite node package.
Comments
Sign in with GitHub to join the discussion.