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. Instead of processing the entire image, it crops the area of interest, processes it at a target resolution, and then stitches it back into the original image. This prevents the degradation of unmasked areas and allows for more detailed or precisely scaled generations.
How it works
The system uses two primary nodes:
- Inpaint Crop: This node extracts a section of the image around the mask. It can pre-resize the image, fill mask holes, expand or blur the mask, and force the cropped area to a specific resolution (e.g., 1024x1024 for SDXL) to ensure the model receives an image in its preferred format.
- Inpaint Stitch: This node takes the processed (inpainted) cropped image and integrates it back into the original image, using automatic blending to ensure there are no visible seams.
Who it’s for
Users of ComfyUI who want to improve the quality and speed of inpainting, particularly when working with high-resolution images where sampling the entire image would be too slow or cause artifacts like "double heads."
Highlights
- Performance: Sampling only the masked area is significantly faster than processing the whole image.
- Detail Enhancement: Enables upscaling the cropped area before sampling to generate more detail, then stitching it back.
- Model Optimization: Allows forcing a specific resolution to match the requirements of models like SDXL or Flux.
- Non-Destructive: Unmasked areas are not modified and do not pass through the VAE encode/decode process.
- Hardware Flexibility: Supports both CPU and GPU modes for processing, with GPU mode offering substantial speed increases.
Related
- Project
- Project
- Project
- Project
- Project