ComfyUI > Nodes > ComfyUI-UniversalToolkit > Restore Crop Box (UTK)

ComfyUI Node: Restore Crop Box (UTK)

Class Name

RestoreCropBox_UTK

Category
UniversalToolkit/Image
Author
whmc76 (Account age: 1110days)
Extension
ComfyUI-UniversalToolkit
Latest Updated
2026-03-16
Github Stars
0.07K

How to Install ComfyUI-UniversalToolkit

Install this extension via the ComfyUI Manager by searching for ComfyUI-UniversalToolkit
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-UniversalToolkit 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

Restore Crop Box (UTK) Description

Restores cropped images to original backgrounds, preserving composition and visual continuity.

Restore Crop Box (UTK):

The RestoreCropBox_UTK node is designed to seamlessly integrate cropped images back into their original backgrounds, effectively restoring them to their initial context. This node is particularly beneficial for AI artists who work with layered images and need to maintain the integrity of the original composition after modifications. By utilizing this node, you can ensure that any cropped sections of an image are accurately repositioned onto the background, preserving the visual continuity and coherence of the artwork. The node achieves this by taking the cropped image and its corresponding mask, and then pasting it back onto the background image at the specified crop box location. This process is essential for tasks that involve image manipulation and editing, where maintaining the original layout and design is crucial.

Restore Crop Box (UTK) Input Parameters:

background_image

The background_image parameter represents the original image onto which the cropped image will be restored. It is crucial as it serves as the canvas for the restoration process. The parameter expects a tensor format of the image, and its size should match the original dimensions to ensure accurate placement of the cropped section.

croped_image

The croped_image parameter is the image section that has been previously cropped and is intended to be restored onto the background. This parameter should be provided in a tensor format and should match the dimensions specified by the crop_box to ensure proper alignment during the restoration process.

invert_mask

The invert_mask parameter is a boolean flag that determines whether the mask should be inverted before applying it to the cropped image. This is useful when the mask needs to be reversed to correctly blend the cropped image with the background. The default value is typically False, meaning no inversion is applied unless specified.

crop_box

The crop_box parameter specifies the coordinates on the background image where the cropped image should be placed. It is a tuple that defines the top-left corner of the placement area, ensuring that the cropped image is accurately positioned within the original context.

croped_mask

The croped_mask parameter is an optional mask that defines the transparency and blending of the cropped image with the background. If provided, it should be in a tensor format and match the dimensions of the croped_image. This mask is crucial for achieving smooth transitions and blending effects.

Restore Crop Box (UTK) Output Parameters:

ret_images

The ret_images output parameter provides the final image(s) with the cropped sections restored onto their respective backgrounds. This output is crucial for verifying the success of the restoration process and ensuring that the visual integrity of the original image is maintained.

ret_masks

The ret_masks output parameter delivers the masks used during the restoration process. These masks are essential for understanding how the cropped images were blended with the background, providing insights into the transparency and blending effects applied.

Restore Crop Box (UTK) Usage Tips:

  • Ensure that the background_image and croped_image are of compatible sizes to avoid misalignment during the restoration process.
  • Utilize the invert_mask parameter when the blending of the cropped image with the background requires the mask to be reversed for correct visual effects.
  • Double-check the crop_box coordinates to ensure that the cropped image is placed accurately within the original context, maintaining the intended composition.

Restore Crop Box (UTK) Common Errors and Solutions:

"Image size mismatch"

  • Explanation: This error occurs when the dimensions of the background_image and croped_image do not match the expected sizes for proper alignment.
  • Solution: Verify that both images are of compatible sizes and adjust the crop_box coordinates to ensure correct placement.

"Invalid mask format"

  • Explanation: This error arises when the croped_mask is not in the correct tensor format or does not match the dimensions of the croped_image.
  • Solution: Ensure that the mask is provided in the correct format and dimensions, and consider using the invert_mask parameter if necessary to achieve the desired blending effect.

Restore Crop Box (UTK) Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-UniversalToolkit
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.

Restore Crop Box (UTK)