KJNodes/imagegenerated

ImageBatchRepeatInterleaving

This node technically uses torch。

Image Batch Repeat Interleaving

images
mask
IMAGE
MASK
repeats
1
KJNodes

The ImageBatchRepeatInterleaving node, which technically uses `torch

The ImageBatchRepeatInterleaving node is a tool for image batch processing. Its core function is to repeat each image in the input batch a specified number of times. It can systematically copy and expand a batch of input images to generate a new batch containing more images.

Node Function

Technically, this node uses the torch.repeat_interleave operation to interleave and repeat the input image tensor along the batch dimension (dim=0). It accepts standard ComfyUI IMAGE and MASK tensor formats and ensures that the output images and masks are consistent in batch size. When no mask is provided, the node automatically generates a mask, marking only the position of the first occurrence of each original image as 1.0.

Node Parameter Description - ImageBatchRepeatInterleaving

Connection Inputs (Inputs)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
imagesIMAGEYes--images (Input Parameter): The input batch of images to be repeated. Type is IMAGE.
maskMASKNo--mask (Input Parameter): Optional parameter. The input mask corresponding to the image batch. Type is MASK.

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
repeatsINTYes11 - 4096repeats (Input Parameter): Specifies the number of times each image is repeated, ranging from 1 to 4096. Default value is 1.

Output

Parameter NameData TypeDescription
IMAGEIMAGEIMAGE (Output Parameter): The output batch of repeated images.
MASKMASKMASK (Output Parameter): The output mask corresponding to the repeated image batch.

Usage Scenarios

This node is very useful in workflows where multiple variations of the same set of images need to be generated or batch augmentation is required. For example, before image upscaling or batch style transfer, you can use this node to repeat the original images multiple times. This allows subsequent nodes to apply different processing parameters to each copy, efficiently generating a series of results.

Notes

Please note that the maximum value for the repeat count (repeats) is 4096, as limited by the node's internal parameter range. Excessively large repeat counts may lead to a significant increase in VRAM usage. Please configure this parameter reasonably according to your hardware capabilities.

The ImageBatchRepeatInterleaving node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…