Nodes/comfyui-AGSoft/AGSoft Inpaint Stitch
ComfyUI Node

AGSoft Inpaint Stitch

The stitch step that makes crop-and-stitch inpainting actually work

By Art-xmaster·Created 12 months ago·Updated a day ago· 23
AGSoft Inpaint Stitch
  • stitcher
  • inpainted_image
  • image
blend_modealpha_blend

Inpaint Stitch is the second half of a crop-and-stitch inpainting pipeline. The first half - AGSoft Inpaint Crop - cuts a region out of your image, pads it, feathers a mask around it, and hands you a cropped latent to run through a KSampler. This node takes the model's result and puts it back where it came from, seam and all. If you've ever composited an inpainted patch back onto the original only to see a hard rectangle, a color mismatch, or a patch that sits a few pixels off from where it should, this is the node that fixes exactly that.

Why go the crop-and-stitch route at all, when Qwen-Image-Edit and friends will happily regenerate a whole image from a sentence? Because a mask still owns two things instruction-editing can't give you: pixels outside the mask that are bit-identical to the original, and full-resolution detail budget inside it. A 64-pixel eye gets a 1024-pixel crop's worth of generation. The catch has always been getting the result back in cleanly - which is this node's entire job.

How it works

You feed it a stitcher object straight out of AGSoft Inpaint Crop, plus the inpainted_image the KSampler produced. The stitcher carries the original image, the crop offset, the cropped shape, the feathered mask, and metadata - you don't wire those up by hand, which is the point of the custom type.

Behind the scenes it reads the original crop offset and shape, then makes sure the inpainted region matches. If your crop node upscaled before sampling (a common trick to give the model more room), it downscales the result back to the original crop size automatically. No manual resize node needed.

Then it picks a blend mode:

  • alpha_blend - smooth blending driven by the feathered mask. It just works, every time, no extra dependencies.
  • poisson_blend - OpenCV's seamless-cloning algorithm, which preserves lighting and texture gradients across the boundary. Better looking for skin and gradients, but it requires opencv-python to be installed. If it isn't, the option shows up as disabled and the node falls back to alpha blending rather than crashing.

Inputs and outputs

  • stitcher (STITCHER) - the data object from AGSoft Inpaint Crop. Required.
  • inpainted_image (IMAGE) - the VAE-decoded result of your inpainting pass, usually from a KSampler. May arrive at a higher resolution than the crop; the node handles that.
  • blend_mode - alpha_blend (default) or poisson_blend.

Output: a single image (IMAGE) - the finished composite.

Installation

This node ships in the comfyui-AGSoft pack, so install the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/Art-xmaster/comfyui-AGSoft.git
# restart ComfyUI

Or open ComfyUI Manager, search "comfyui-AGSoft", and hit Install. The pack pulls in numpy and opencv-python - the OpenCV dependency is exactly what unlocks poisson_blend, so let the install finish rather than skipping requirements. No model files are needed for this node.

Where people get burned

The most common miss is expecting poisson blending and not having OpenCV installed - your blend mode list simply won't include a working option. The second is forgetting this node only makes sense after the matching Inpaint Crop node; if you hand it a stitcher from anything else, there's nothing to stitch. If your seam still shows, go back to the crop node and check its feathering setting - a feathered mask is what makes alpha blending invisible, and a feather of zero is basically a hard rectangle with extra steps.

CategoryAGSoft/Inpainting

Inputs (3)

NameTypeDefaultDescription
stitcherSTITCHERДанные от ноды AGSoft Inpaint Crop. Содержит оригинал, координаты обрезки, маску и метаданные.
inpainted_imageIMAGEРезультат inpainting-модели (например, от KSampler). Может быть в увеличенном разрешении.
blend_modeCOMBOalpha_blendРежим сшивания: • alpha_blend — плавное смешивание по маске. Работает всегда. • poisson_blend — продвинутое сшивание через OpenCV. Сохраняет освещение и текстуру. Требует установки opencv-python.

Outputs (1)

NameTypeDescription
imageIMAGE