lquesada/ComfyUI-Inpaint-CropAndStitch
ComfyUI nodes to crop before sampling and stitch back after sampling that speed up inpainting
What it solves
This project provides a way to perform high-quality inpainting by focusing only on the masked area of an image rather than processing the entire frame. This avoids the need to sample the whole image, which is slower and can lead to artifacts like "double heads" or double bodies when the area is too large, and prevents the unmasked parts of the image from being altered by VAE encoding/decoding.
How it works
The system uses two primary nodes: Inpaint Crop and Inpaint Stitch.
- Inpaint Crop: This node isolates the masked area. It can pre-resize the image, fill mask holes, expand or blur the mask, and crop the image around the mask (with optional context area). It can also force the cropped area to a specific target resolution (e.g., 1024x1024 for SDXL) and ensure the output is padded to a multiple of a specific value (e.g., 8, 16, 32) for model compatibility.
- Inpaint Stitch: This node takes the processed/inpainted cropped image and seamlessly blends it back into the original image, ensuring that unmasked areas remain untouched.
Who it’s for
Users of ComfyUI who want more control over inpainting and outpainting, specifically those looking to increase detail through upscaling before sampling or to improve speed and accuracy by limiting the sampling area.
Highlights
- Performance: Significantly faster sampling by focusing only on the masked region.
- Precision: Prevents modification of unmasked areas, bypassing VAE encode/decode for those sections.
- Flexibility: Supports pre-resizing, outpainting extensions, and forcing specific resolutions for different models (SD 1.5, SDXL, Flux).
- Detail Enhancement: Allows upscaling the cropped area before sampling and then stitching it back to generate more detail.
- GPU Acceleration: Includes a GPU mode for 30x-100x faster processing, especially useful for video inpainting.
Related
- Project
- Project
- Project
- Project
- Project