KJNodes/imagegenerated

Insert Images To Batch Indexed(InsertImagesToBatchIndexed)

This node takes two image batch tensors as input and determines the operation position by parsing a comma-separated index string.

Insert Images To Batch Indexed

original_images
images_to_insert
IMAGE
indexes
0, 1, 2
mode
COMBO
KJNodes

The Insert Images To Batch Indexed node receives two image batch tensors as input and determines the operation positions by parsing a comma-separated index string.

The Insert Images To Batch Indexed node is used to insert or replace a set of images into specified positions within the original image batch. It allows users to precisely control the positions of new images within the batch sequence, enabling flexible reorganization of image collections.

Node Functionality

This node receives two image batch tensors as input and determines the operation positions by parsing a comma-separated index string. Its core mechanism provides two modes: the replace mode directly overwrites images at the specified indices in the original batch, while the insert mode inserts new images at the specified indices, shifting subsequent images backward, thereby increasing the total length of the batch.

Node Parameter Description - Insert Images To Batch Indexed

Connection Inputs (Inputs)

Parameter NameData TypeRequiredDefault ValueValue Range/OptionsDescription
original_imagesIMAGEYes--: The original image batch on which insertion or replacement operations will be performed.
images_to_insertIMAGEYes--: The image batch to be inserted or used for replacement. Its count should match the length of the index list or be reusable in a loop.

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueValue Range/OptionsDescription
indexesSTRINGYes0, 1, 2-: A string specifying the indices for the operation. Multiple indices must be separated by English commas, e.g., "0, 3, 5".
modeCOMBONoreplace"replace", "insert"-

Output

Parameter NameData TypeDescription
IMAGEIMAGE: The processed new image batch.

Usage Scenarios

This node is highly useful in image batch processing workflows. For example, after generating a batch of images, if you want to replace a few defective images with corrected versions, you can use the replace mode. Alternatively, when creating an animation sequence, you can insert additional transition frames at specific keyframe positions, in which case the insert mode should be selected.

Notes

Please note that the input index values must be within the valid index range of the original image batch (starting from 0). For the insert mode, the index list should be in ascending order to ensure that insertion operations proceed as expected; otherwise, the results may become disordered.

The Insert Images To Batch Indexed node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…