KJNodes/maskinggenerated

Batch Uncrop Advanced(BatchUncropAdvanced)

This node takes the original image, the cropped image, the corresponding crop mask, a composite mask, and bounding box data as inputs.

Batch Uncrop Advanced

original_images
cropped_images
cropped_masks
combined_crop_mask
bboxes
combined_bounding_box
IMAGE
border_blending
0.25
crop_rescale
1.00
use_combined_mask
use_square_mask
KJNodes

The Batch Uncrop Advanced node receives the original image, the cropped image, the corresponding crop mask, a combined mask, and bounding box data as inputs.

The Batch Uncrop Advanced node is an advanced image processing node specifically designed to accurately re-integrate cropped and modified image fragments back into the original background image. Its core functionality is to process images in batches and supports the use of masks and bounding boxes to control the blending process, achieving seamless compositing results.

Node Functionality

This node receives the original image, the cropped image, the corresponding crop mask, a combined mask, and bounding box data as inputs. Its technical implementation relies on these masks and bounding box information to locate and blend the images. It supports feathering the blend edges (via the border_blending parameter) and allows scaling of the cropped area (via the crop_rescale parameter) to fine-tune the compositing result.

Node Parameter Description - Batch Uncrop Advanced

Connection Inputs (Inputs)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
original_imagesIMAGEYes--original_images (Input Parameter): The original full image serving as the background, onto which the cropped images will be blended. The number of input images must match the number of cropped_images.
cropped_imagesIMAGEYes--cropped_images (Input Parameter): The cropped image fragments that need to be pasted back onto the original background. The quantity must be the same as original_images.
cropped_masksMASKYes--cropped_masks (Input Parameter): The mask corresponding to each cropped_image, used to define the valid area within each cropped fragment that needs to be blended.
combined_crop_maskMASKYes--combined_crop_mask (Input Parameter): A combined mask, typically formed by merging the masks of all cropped areas, used to define the overall pasteable region.
bboxesBBOXYes--bboxes (Input Parameter): A list of bounding boxes specifying the precise location and extent within the original_images where each cropped_image should be placed.
combined_bounding_boxBBOXNo--combined_bounding_box (Input Parameter): An optional bounding box that defines the overall region for the combined mask. If not provided, the bounding box is derived from the individual bboxes.

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
border_blendingFLOATYes0.250.0 - 1.0 (Step: 0.01)border_blending (Input Parameter): Controls the feathering intensity of the blend boundary, range 0.0 to 1.0, step 0.01. A higher value results in a smoother edge transition.
crop_rescaleFLOATYes1.00.0 - 10.0 (Step: 0.01)crop_rescale (Input Parameter): The scaling factor applied to cropped_images, range 0.0 to 10.0, step 0.01. 1.0 means maintaining the original size.
use_combined_maskBOOLEANYesFalse-use_combined_mask (Input Parameter): Boolean value. When True, uses combined_crop_mask for global blending control; when False, uses individual cropped_masks.
use_square_maskBOOLEANYesTrue-use_square_mask (Input Parameter): Boolean value. When True, processes the mask shape into a square; when False, retains the original mask shape.

Output

Parameter NameData TypeDescription
IMAGEIMAGEIMAGE (Output Parameter): Outputs the final composited full image, with all cropped fragments blended into the original background.

Usage Scenarios

A typical application is within "inpainting" or "image restoration" workflows. For example, a user can first use other nodes (such as a Bounding Box node) to select multiple areas from the original image that require modification. After redrawing or editing these areas separately, this node can be used to paste all modified areas back into the original image at once and naturally, thereby efficiently completing multi-target editing.

Notes

When using this node, please note that the number of images in the input original_images and cropped_images groups must be strictly identical. If more bounding boxes (bboxes) are provided than there are images, the extra bounding boxes will be automatically ignored.

The Batch Uncrop Advanced node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…