Overview
I recently published a couple of nodes that automate and significantly improve inpainting by enabling the sampling to take place only on the masked area.
The main advantages these nodes offer are:
They make it much faster to inpaint than when sampling the whole image.
They enable setting the right amount of context from the image for the prompt to be more accurately represented in the generated picture.
They enable upscaling before sampling in order to generate more detail, then stitching back in the original picture.
They enable downscaling before sampling if the area is too large, in order to avoid artifacts such as double heads or double bodies.
They enable forcing a specific resolution (e.g. 1024x1024 for SDXL models).
Tutorial
Download
The nodes can be downloaded using ComfyUI-Manager, just look for "Inpaint-CropAndStitch".
You can also get them, together with several example workflows that work out of the box from https://github.com/lquesada/ComfyUI-Inpaint-CropAndStitch