🖼️🧵AGSoft Crop Stitch
AGSoft Crop Stitch
- crop_data
- image
- image
Cropping is the easy half. The part everyone fumbles is putting the fixed pixels back without a visible seam - and that's the whole job of 🧵 AGSoft Crop Stitch. It takes a processed crop, a box that describes where it came from, and the original image, and pastes the crop back into place with a blend so clean you can't find the border. If you've ever done the "inpaint one eye at full res" dance and ended up with a visible rectangle, this is the node that fixes the rectangle.
It's the stitcher for the crop-and-stitch workflow: ✂️ AGSoft Image Crop Plus cuts a region out (and hands you crop_data), you run that region through whatever you want - a KSampler at native resolution, a detailer, a text edit model - then feed the result back into Crop Stitch along with the original crop_data. What you get out is the untouched original with only the box area replaced. Nothing outside the box moves so much as a pixel, which is exactly the "bit-identical unmasked pixels" advantage masked inpainting still owns over whole-image edit models. The KB's inpainting essay calls this the "only masked" approach: a 64px eye gets a 1024px generation budget, then gets parked back exactly where it lives.
How it works
The node never guesses where the crop goes - that's the point of crop_data, a bundle that carries the original image plus the x, y, w, h box from Image Crop Plus. It clones the original, resizes your processed frame to the box size if it doesn't already match (Lanczos, so you can upscale a small crop to fill the box cleanly), then blends three ways:
- paste - hard replace. The processed pixels just overwrite the box. Fine for a crop that already matches its surroundings; brutal for anything that doesn't.
- feather_blend - the default. It builds a distance-based weight ramp: 0 at the box border fading to 1 in the center, controlled by the
featheringwidth. Original pixels fade into yours over that band, so the seam disappears even when colors don't match perfectly. - poisson_blend - the fancy one. It calls OpenCV's
seamlessClonewithNORMAL_CLONE, which solves for gradients instead of raw pixels, so it preserves the lighting of the destination while importing your content. Great when you generated a crop with different shading than its surroundings.
The inputs that matter
Three of them, honestly:
- crop_data - must come from ✂️ AGSoft Image Crop Plus. This is the node's memory: it remembers the original and the box.
- image - your processed crop. Feed it as a single frame; the node only looks at
image[0], so a batch doesn't help here. - blend_mode and feathering - start with
feather_blendandfeatheringaround 16; push higher for big crops, lower for tiny ones. Switch topoisson_blendonly when feathering leaves a visible edge, since it's slower and less predictable.
The single image output wires straight into a Save Image or Preview.
Installation
One-liner, or Manager - either works. ComfyUI Manager: search comfyui-AGSoft and install. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/Art-xmaster/comfyui-AGSoft
Restart ComfyUI after. The pack's pyproject.toml pulls in opencv-python>=4.7.0.72 (plus numpy and translators), so a Manager install brings OpenCV with it - which you need for poisson_blend. If you cloned manually and skipped requirements, poisson_blend still appears in the dropdown but silently degrades to paste, and the README won't tell you why.
Gotchas
Where people trip: poisson_blend needs OpenCV - without it the mode is a lie (it lists itself as "unavailable" in the dropdown and falls back to paste). Batch images silently use only the first frame of your processed crop. And remember the blend can't fix a crop that's wildly off in color - feather_blend softens the seam, but it won't reconcile two totally different lightings; that's what poisson_blend is for. It's a small node in a huge pack (this one ships 100+ utilities), so if the box feels odd, the crop_data wire is almost always the culprit - make sure it's the same Image Crop Plus node that actually cut the crop.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| crop_data | CROP_DATA | Данные от ✂️AGSoft Image Crop Plus (оригинал + бокс). --- Data from ✂️AGSoft Image Crop Plus (original + box). | |
| image | IMAGE | Обработанный кадр (может быть другого размера — будет ресайз). --- Processed frame (any size — will be resized). | |
| blend_mode | COMBO | feather_blend | paste — жёсткая вставка; feather_blend — плавный шов; poisson_blend — сохранение освещения (нужен opencv). --- paste — hard paste; feather_blend — smooth seam; poisson_blend — lighting-preserving (needs opencv). |
| feathering | INT | 160–128 | Ширина плавного шва для feather_blend. --- Seam width for feather_blend. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |