ComfyUI-KJNodes
Run ComfyUI Easily with InstaSD
Skip the complex setup. InstaSD helps creative professionals build workflows and deploy them to the world:
- One-click deployment
- Any model, any node
- Powerful GPUs for rapid iteration
Available Nodes
InsertImageBatchByIndexes
InsertImageBatchByIndexes Node Documentation
Overview
The InsertImageBatchByIndexes node is a processing component in ComfyUI designed to facilitate the insertion of image batches back into their original sequence. This node is particularly useful in workflows where images are filtered out for certain operations and need to be reinserted into their initial positions in the image sequence. The primary use case for this node involves its integration with the FilterZeroMasksAndCorrespondingImages node.
Functionality
This node takes a batch of images and inserts another set of images at specified indexes within the batch. It ensures that images to be inserted are placed at their correct positions based on the provided index list, preserving the original order where applicable. This functionality is crucial for workflows that manipulate or modify image sequences and need to maintain consistency with their original order.
Inputs
The InsertImageBatchByIndexes node accepts the following inputs:
-
Images:
- Type: IMAGE
- Description: The original batch of images into which other images will be inserted.
-
Images to Insert:
- Type: IMAGE
- Description: The batch of images that are to be inserted into the original image sequence.
-
Insert Indexes:
- Type: INDEXES
- Description: A list of indices specifying where each of the
Images to Insertshould be placed in theImagesbatch. The length of this list should match the number of images in theImages to Insert.
Outputs
The node produces the following output:
- Images After Insert:
- Type: IMAGE
- Description: The updated batch of images with the
Images to Insertplaced according to the specifiedInsert Indexes, preserving the original order elsewhere.
Usage in ComfyUI Workflows
The InsertImageBatchByIndexes node is typically used in workflows that require the temporary removal of certain images for processing or filtering, especially in scenarios involving masking operations. For instance, after using the FilterZeroMasksAndCorrespondingImages node to remove images with zero masks, this node can be employed to reinsert the filtered images back into their original sequence positions.
Example Workflow
- Initial Image Batch: Begin with an original batch of images.
- Filtering Step: Utilize nodes like
FilterZeroMasksAndCorrespondingImagesto filter out specific images, which results in a modifications on the batch. - Reinsertion Using InsertImageBatchByIndexes: Following processing, use the
InsertImageBatchByIndexesnode to reinsert filtered out images such as those with zero masks back into their original index locations within the batch.
Special Features and Considerations
- Index Alignment: It is crucial that the number of images in the
Images to Insertmatches the number of indices inInsert Indexes. A mismatch will prompt a warning and the node will not execute as intended. - Order Preservation: This node ensures that the order of the original images is preserved while integrating new images at specified positions.
- Error Handling: In cases where the lengths of
Images to InsertandInsert Indexesdo not align, the node will issue a warning and maintain the original image sequence unchanged.
This node is a powerful tool for maintaining and reconstructing image sequences in complex workflows requiring selective image manipulation and reintegration.