Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > ComfyUI-CustomNodeKit > 图像批次替换 (Batch Replace)

ComfyUI Node: 图像批次替换 (Batch Replace)

Class Name

BatchImageReplace

Category
image
Author
user2318 (Account age: 2574days)
Extension
ComfyUI-CustomNodeKit
Latest Updated
2026-07-16
Github Stars
0.05K

How to Install ComfyUI-CustomNodeKit

Install this extension via the ComfyUI Manager by searching for ComfyUI-CustomNodeKit
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-CustomNodeKit in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

图像批次替换 (Batch Replace) Description

Facilitates batch image replacement with flexible range and handling options for efficient dataset manipulation.

图像批次替换 (Batch Replace):

The BatchImageReplace node is designed to facilitate the replacement of images within a batch, allowing you to substitute specific images with alternatives from another batch. This node is particularly useful when you need to update or modify parts of an image dataset without altering the entire batch. It provides a flexible mechanism to specify the starting point and the number of images to replace, ensuring that your image processing tasks can be tailored to specific needs. The node also offers options to handle scenarios where the replacement batch is smaller or larger than the specified range, ensuring that the operation is robust and adaptable to various batch sizes. By using this node, you can efficiently manage and manipulate image datasets, making it an essential tool for AI artists working with large volumes of images.

图像批次替换 (Batch Replace) Input Parameters:

images

This parameter represents the main image batch, formatted as [B, H, W, C], where B is the batch size, H is the height, W is the width, and C is the number of channels. It is the primary dataset where images will be replaced at specified positions. The images parameter is crucial as it defines the original set of images that you intend to modify.

replace_images

This optional parameter is the replacement image batch, also formatted as [B, H, W, C]. It provides the images that will be used to replace those in the main batch. If this parameter is not connected, the node will pass through the original images unchanged. This allows for flexibility in operations, enabling you to either replace images or maintain the original batch as needed.

start_index

This parameter specifies the starting index in the main image batch from which the replacement should begin. It determines the position in the batch where the first replacement will occur, allowing you to control precisely where changes are made within the dataset.

replace_count

This parameter defines the number of images to replace in the main batch, starting from the start_index. It allows you to specify how many images should be substituted, providing control over the extent of the replacement operation.

overflow_mode

This parameter dictates how the node should handle situations where the replacement batch is larger than the available space in the main batch. Options include filling the remaining space with the last image from the replacement batch or other strategies to manage overflow effectively.

underflow_mode

This parameter manages scenarios where the replacement batch is smaller than the specified range. By default, it is set to "as_is," meaning no additional images will be added if the replacement batch runs out before completing the specified replace_count.

图像批次替换 (Batch Replace) Output Parameters:

result

The output parameter result is the modified image batch after the replacement operation. It reflects the changes made to the original batch, with specified images replaced by those from the replacement batch. This output is crucial for verifying that the intended modifications have been successfully applied to the dataset.

图像批次替换 (Batch Replace) Usage Tips:

  • Ensure that the start_index and replace_count are set correctly to target the specific images you wish to replace within the batch.
  • Use the overflow_mode and underflow_mode settings to handle batch size discrepancies effectively, ensuring that your replacement operations are robust and error-free.
  • When working with large image batches, consider the dimensions of both the main and replacement images to avoid unexpected resizing or cropping.

图像批次替换 (Batch Replace) Common Errors and Solutions:

"start_index={start_index} >= batch_size={B}, no valid replacement range, returning orig"

  • Explanation: This error occurs when the specified start_index is greater than or equal to the size of the batch, meaning there is no valid range for replacement.
  • Solution: Adjust the start_index to ensure it falls within the valid range of the batch size.

"Replacement image batch is None, passing through original images unchanged"

  • Explanation: This message indicates that the replace_images parameter is not connected, so the node will not perform any replacements and will return the original batch.
  • Solution: Connect a valid replacement image batch to the replace_images parameter if you intend to perform replacements.

"replace_count is 0, returning original batch"

  • Explanation: This occurs when the replace_count is set to zero, meaning no images are specified for replacement.
  • Solution: Set the replace_count to a positive integer to perform the desired number of replacements.

图像批次替换 (Batch Replace) Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-CustomNodeKit
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

图像批次替换 (Batch Replace)