ComfyUI > Nodes > ComfyUI-YCNodes > MaskCropRestore_YC

ComfyUI Node: MaskCropRestore_YC

Class Name

MaskCropRestore_YC

Category
YCNode/Mask
Author
yichengup (Account age: 473days)
Extension
ComfyUI-YCNodes
Latest Updated
2025-06-03
Github Stars
0.02K

How to Install ComfyUI-YCNodes

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

MaskCropRestore_YC Description

Seamlessly integrate cropped images back into original context using mask-based restoration for precise image restorations.

MaskCropRestore_YC:

The MaskCropRestore_YC node is designed to seamlessly integrate cropped images back into their original context by utilizing a mask-based restoration process. This node is particularly beneficial for tasks that involve image editing or manipulation, where specific regions of an image have been altered or enhanced separately and need to be reintegrated into the original image. By leveraging the coordinates of the cropped area and optional masks, the node ensures that the cropped image is accurately placed back into its original position, maintaining the integrity and continuity of the visual content. This functionality is crucial for AI artists who need to perform precise image restorations without compromising the overall composition.

MaskCropRestore_YC Input Parameters:

background_image

The background_image parameter is the original image from which a section was cropped. It serves as the canvas onto which the cropped image will be restored. This parameter is crucial as it provides the context and reference for the restoration process. There are no specific minimum or maximum values, but it should be a valid image format.

cropped_image

The cropped_image parameter is the section of the image that was previously cropped and possibly modified. This image will be placed back onto the background_image at the specified coordinates. It is essential for this parameter to match the dimensions and format expected by the node to ensure a seamless restoration.

crop_coords

The crop_coords parameter specifies the coordinates of the cropped area within the original image. It is a tuple containing the x and y minimum and maximum values, which define the bounding box of the cropped section. Accurate coordinates are vital for ensuring that the cropped image is restored to its correct position.

invert_mask

The invert_mask parameter is a boolean option that determines whether the mask used in the restoration process should be inverted. By default, it is set to False. Inverting the mask can be useful in scenarios where the areas to be excluded from the restoration need to be specified instead of the areas to be included.

cropped_mask (optional)

The cropped_mask parameter is an optional mask that defines the specific areas of the cropped_image to be restored. If provided, it allows for more precise control over which parts of the cropped image are integrated back into the background_image.

crop_frame (optional)

The crop_frame parameter is another optional mask that can be used to define the restoration area. It serves a similar purpose to the cropped_mask and provides additional flexibility in specifying the restoration boundaries.

MaskCropRestore_YC Output Parameters:

image

The image output is the result of the restoration process, where the cropped_image has been successfully integrated back into the background_image. This output maintains the original dimensions and context of the background_image, with the modifications applied.

inpaint_mask

The inpaint_mask output is a mask that indicates the areas of the background_image that have been modified during the restoration process. This mask is useful for further processing or analysis, as it highlights the regions that were affected by the restoration.

MaskCropRestore_YC Usage Tips:

  • Ensure that the crop_coords accurately reflect the original position of the cropped section to avoid misalignment during restoration.
  • Utilize the invert_mask option when you need to exclude specific areas from the restoration, providing greater control over the final output.
  • When working with complex images, consider using the cropped_mask or crop_frame to refine the restoration process and achieve more precise results.

MaskCropRestore_YC Common Errors and Solutions:

Misaligned Restoration

  • Explanation: The restored image appears misaligned with the original background.
  • Solution: Double-check the crop_coords to ensure they accurately represent the original position of the cropped section.

Mask Dimension Mismatch

  • Explanation: The provided mask dimensions do not match the expected size, leading to errors.
  • Solution: Verify that the cropped_mask or crop_frame dimensions align with the cropped_image and adjust if necessary.

Inverted Mask Issues

  • Explanation: The restoration does not apply as expected due to an inverted mask.
  • Solution: Review the invert_mask setting to ensure it is correctly configured for your specific use case.

MaskCropRestore_YC Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-YCNodes
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 Playground, enabling artists to harness the latest AI tools to create incredible art.