Image Uncrop By Mask(ImageUncropByMask)
This node takes the target image, source image, mask, and bounding box as inputs.
Image Uncrop By Mask
The Image Uncrop By Mask node takes a destination image, a source image, a mask, and a bounding box as inputs.
The Image Uncrop By Mask node is used to seamlessly composite a source image into a specific area of a destination image based on a specified mask and bounding box. Its core function is to perform an "uncrop" operation, allowing users to precisely embed an image element into a designated location of another image and achieve smooth blending using the mask.
Node Functionality
This node takes a destination image, a source image, a mask, and a bounding box as inputs. Internally, it upscales the source image to the dimensions of the bounding box using the Lanczos algorithm and upscales the mask using bilinear interpolation. Subsequently, by calculating padding values, it precisely places the adjusted source image and mask onto the corresponding coordinates of the destination image, ultimately outputting the composited final image.
Node Parameter Description - Image Uncrop By Mask
Inputs
| Parameter Name | Data Type | Required | Default Value | Range/Options | Description |
|---|---|---|---|---|---|
destination | IMAGE | Yes | - | - | destination (Input Parameter): The target image serving as the background onto which the source image will be composited. |
source | IMAGE | Yes | - | - | source (Input Parameter): The source image to be composited onto the destination image. |
mask | MASK | Yes | - | - | mask (Input Parameter): A mask, typically single-channel, defining which parts of the source image should be composited onto the destination image. |
bbox | BBOX | Yes | - | - | The bounding box used to specify the placement location and extent of the source image within the destination image. |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
image | IMAGE | image (Output Parameter): The final composited output image. |
Usage Scenarios
A typical usage scenario is in image inpainting or editing, where a user can first use other nodes (such as a Bounding Box detector) to identify the area that needs replacement, and then use this node to precisely paste new image content (e.g., an inpainted fragment) back into the original image. This is common in workflows involving face replacement, object removal and filling, or local style transfer.
Image Uncrop By Mask Node Source Code Link
The Image Uncrop By Mask node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.