KJNodes/imagegenerated

Insert Image Batch By Indexes(InsertImageBatchByIndexes)

This node takes two image batches and an index list as input.

Insert Image Batch By Indexes

images
images_to_insert
insert_indexes
images_after_insert
KJNodes

The Insert Image Batch By Indexes node receives two image batches and a list of indexes as input.

The Insert Image Batch By Indexes node is a utility tool for image batch processing operations. Its core function is to insert a set of images into another image sequence at specified index positions, thereby generating a new, sequentially updated image batch.

Node Functionality

This node receives two image batches and a list of indexes as input. Its internal mechanism checks whether the number of images to be inserted matches the number of provided indexes. If they match, it inserts the images into the original sequence at the positions specified by the indexes. The output is a new batch that maintains the original order but includes the newly inserted images. It is specifically designed to work with the FilterZeroMasksAndCorrespondingImages node for reorganizing filtered image sequences.

Node Parameter Description - Insert Image Batch By Indexes

Connection Inputs (Inputs)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
imagesIMAGEYes--images (input parameter): The original image batch serving as the base sequence to be inserted into.
images_to_insertIMAGEYes--images_to_insert (input parameter): The new image batch that needs to be inserted into the original sequence.
insert_indexesINDEXESYes--insert_indexes (input parameter): A list of position indexes specifying where the new images should be inserted in the final merged sequence.

Output

Parameter NameData TypeDescription
images_after_insertIMAGEimages_after_insert (output parameter): The final image sequence generated after inserting the new images.

Usage Scenarios

A typical usage scenario is in image inpainting or content replacement workflows. For example, after using masks to filter out specific frames that need replacement, you can use this node to precisely insert newly generated or repaired images back into the corresponding positions of the original video frame sequence, thereby achieving seamless updates to local content.

Notes

When using this node, note that the number of images to be inserted must exactly match the number of provided indexes; otherwise, the node will skip processing and issue a warning. Index values should be planned based on the total length of the final merged sequence.

The Insert Image Batch By Indexes node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…