ComfyUI  >  Nodes  >  ComfyUI-Inpaint-CropAndStitch

ComfyUI Extension: ComfyUI-Inpaint-CropAndStitch

Repo Name


lquesada (Account age: 4048 days)
View all nodes (4)
Latest Updated
Github Stars

How to Install ComfyUI-Inpaint-CropAndStitch

Install this extension via the ComfyUI Manager by searching for  ComfyUI-Inpaint-CropAndStitch
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-Inpaint-CropAndStitch 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
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

ComfyUI-Inpaint-CropAndStitch Description

ComfyUI-Inpaint-CropAndStitch features two nodes: 'Inpaint Crop' for cropping images before sampling using a mask, expand pixels, or expand factor, and 'Inpaint Stitch' for seamlessly reintegrating the inpainted image into the original without affecting unmasked areas.

ComfyUI-Inpaint-CropAndStitch Introduction

ComfyUI-Inpaint-CropAndStitch is an extension designed to enhance the inpainting process for AI-generated images. Inpainting is a technique used to fill in missing or damaged parts of an image. This extension provides a set of tools that allow you to crop, resize, and stitch images efficiently, ensuring that the inpainted areas blend seamlessly with the original image.

Key Features:

  • Inpaint Crop: Crops an image before sampling, allowing you to focus on specific areas.
  • Inpaint Stitch: Stitches the inpainted image back into the original without altering unmasked areas.
  • Extend Image for Outpainting: Extends an image and masks to use the power of Inpaint Crop and Stitch for outpainting.
  • Resize Image Before Inpainting: Resizes an image before inpainting to maintain or enhance detail. These features help AI artists by speeding up the inpainting process, providing more control over the context and resolution, and ensuring high-quality results without affecting the unmasked parts of the image.

How ComfyUI-Inpaint-CropAndStitch Works

The extension works by breaking down the inpainting process into manageable steps:

  1. Cropping: The "Inpaint Crop" node allows you to crop the image to focus on the area that needs inpainting. This can be done using a mask to specify the area or by expanding the context area around the mask.
  2. Resizing: The "Resize Image Before Inpainting" node lets you resize the cropped area. You can upscale to add more detail or downscale to avoid artifacts.
  3. Inpainting: The inpainting process is applied to the cropped and resized area.
  4. Stitching: The "Inpaint Stitch" node stitches the inpainted area back into the original image, ensuring that the unmasked areas remain unchanged. By focusing only on the masked area, the extension makes the inpainting process faster and more efficient, while also allowing for better control over the final output.

ComfyUI-Inpaint-CropAndStitch Features

Inpaint Crop

  • Context Expand Pixels: Specifies how much to grow the context area around the original mask in pixels.
  • Context Expand Factor: Specifies how much to grow the context area around the original mask as a factor (e.g., 1.1 for 10% growth).
  • Fill Mask Holes: Fills any holes in the mask, marking fully enclosed areas as part of the mask.
  • Blur Mask Pixels: Grows and blurs the mask by the specified number of pixels.
  • Invert Mask: Inverts the mask, keeping only the marked areas.

Inpaint Stitch

  • Blend Pixels: Grows and blurs the stitch mask to blend the inpainted area seamlessly with the original image.
  • Rescale Algorithm: Chooses the rescale algorithm (e.g., bislerp for high quality, bicubic for faster processing).

Extend Image for Outpainting

  • Mode:
  • Free Size: Uses a rescale factor to optionally rescale the content before sampling.
  • Forced Size: Uses specified width and height to upscale the content before sampling.
  • Ranged Size: Upscales the area to fit within specified minimum and maximum dimensions.

Resize Image Before Inpainting

  • Rescale Factor: Allows you to upscale or downscale the image before inpainting.

ComfyUI-Inpaint-CropAndStitch Models

The extension does not include specific models but works with any inpainting models you have. For best results, use models designed for inpainting, such as lazymixRealAmateur_v40Inpainting.

What's New with ComfyUI-Inpaint-CropAndStitch


  • New Node: "Resize Image Before Inpainting" to increase the resolution of the input image for higher resolution inpaintings.


  • New Node: "Extend Image for Outpainting" to leverage Inpaint Crop and Stitch for outpainting.


  • Blending Radius: Added for seamless inpainting.
  • Blur Mask Setting: Added to grow and blur the mask for better support.
  • Default Mode: Updated to ranged size.


  • Force Size: Now specified as separate width and height.
  • New Mode: Ranged size to avoid over or under scaling.


  • Mode-Specific Fields: Some fields are hidden depending on the selected mode.


  • Batch Support: Added.
  • Rescaling Algorithm: Enabled selection and made bicubic the default for crop.


  • Modes: Switched to free size and forced size.
  • Internal Upscale Factor: Can be lower than 1 to avoid double head issues.
  • Padding: Added to avoid artifacts.


  • Internal Upscale Factor: Added to upscale before sampling and downsize before stitching.


  • Initial Commit: The extension was first released.

Troubleshooting ComfyUI-Inpaint-CropAndStitch

Common Issues and Solutions

  1. Artifacts in the Inpainted Area:
  • Solution: Try using the blur mask feature to smooth out the edges of the mask.
  1. Double Heads or Bodies:
  • Solution: Use the internal upscale factor to downscale the area before sampling.
  1. Seams in the Stitched Image:
  • Solution: Adjust the blend pixels setting to ensure a seamless blend.
  1. Slow Processing:
  • Solution: Use the bicubic rescale algorithm for faster processing.

Frequently Asked Questions

  • Q: Can I use this extension with any inpainting model?
  • A: Yes, it works with any inpainting model, but using models specifically designed for inpainting will yield better results.
  • Q: How do I avoid artifacts when cropping large areas?
  • A: Downscale the area before sampling to avoid artifacts.

Learn More about ComfyUI-Inpaint-CropAndStitch

For more information, tutorials, and community support, check out the following resources:

  • These resources will help you get the most out of the ComfyUI-Inpaint-CropAndStitch extension and connect with other AI artists for tips and support.

ComfyUI-Inpaint-CropAndStitch Related Nodes


© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.