Region Stitch π§©
Paste the variants back, keep the rest of the frame identical
- region
- variant
- mask
- variant_2
- mask_2
- variant_3
- mask_3
- variant_4
- mask_4
- variant_5
- mask_5
- variant_6
- mask_6
- variant_7
- mask_7
- variant_8
- mask_8
- image
Region Stitch is the half of the crop-and-stitch loop that everyone underestimates until the first time they do it by hand. You generated something in a crop; now you have to put it back at the exact pixel offset you cut it from, and blend the edge so it doesn't look like a sticker. Doing that manually means tracking coordinates in a text file and getting the paste order right every time you re-run.
This node takes the region bundle from Region Select and does that arithmetic for you. Nothing more, and that's the point.
How it works
Read the source and it's short: it clones the original image out of the bundle, then for every region that has a connected variant it composites one rectangle. Specifically:
- The variant is resized to the region's width and height (Lanczos), so you can generate at whatever resolution your model likes.
- A mask is built - all-ones if you didn't connect one - then Gaussian-blurred by
blur, then multiplied by a linear edge ramp that fades to zero at all four borders. base * (1 - m) + variant * mover that rectangle only.
Regions without a variant are skipped silently, in order, and the result is one full-resolution IMAGE. Because the base is a clone of the original pixels, the unmasked part of your frame comes out exactly as it went in - no VAE encode/decode of the whole image. That property is the entire reason masked workflows are still worth running next to a Qwen or Klein edit pass, and it's a structural guarantee here rather than a discipline you have to maintain.
Inputs and output
region (required) is the bundle, and it will only accept output from Region Select - it's a custom type, not an IMAGE, so you can't feed it anything else. blur defaults to 16 and is the feather radius in pixels; it does double duty as both the Gaussian radius on the mask and the width of the edge ramp. Set it to 0 and you get a hard-edged rectangle, which is a legitimately useful way to see exactly what got pasted.
Then variant, variant_2 β¦ variant_8, each matched by number to the regions in the bundle - variant_3 goes wherever region 3 currently is. The matching mask / mask_2 β¦ slots are optional MASK inputs where white means "keep this pixel from the variant." They're resized to the region for you, so a segmented face mask from a detector, a painted mask from a preview node, or a hand-drawn one all work. The README suggests Impact Pack's Preview Bridge for painting on the variant; any mask producer in your graph is fine.
Output is a single image. Send it to Save Image, or to another pass.
Install
ComfyUI Manager, search Momo Nodes. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/Phykrex/ComfyUI-Momo-Nodes.git
Restart ComfyUI. No requirements.txt, no model files - Pillow, torch and numpy only, all already present in a ComfyUI install. The node appears under MomoNodes/region as Region Stitch π§©.
Gotchas worth knowing up front
Only the first image of a batch gets pasted. The paste code takes variant[0:1]. If your sampler returned four seeds as a batch, one goes in and three are ignored, with no warning. Run them one at a time.
Index drift is silent. Variant slots are positional, not remembered. Delete region 2 in Region Select after you've wired everything and every variant below it shifts up one position, so your new sky lands on the street. Re-check the wiring whenever you change num_regions.
A soft ring at the paste edge is the feather, not a bug. The edge ramp fades the variant into the original over blur pixels, so if the variant's brightness or color doesn't match its surroundings you'll see a halo. Lower blur for a tighter paste; the ramp is capped at half the region's size, so a large blur on a small region feathers most of the way to the middle and leaves you with a washed-out center.
Seam? That's blur at or near 0. Hole in the middle of the paste? You connected an inverted mask - white keeps the variant, black keeps the original. Nothing pasted at all? The variant input isn't actually connected; missing variants are skipped quietly rather than erroring.
One more: if you're on a checkout from before September 2026 you may hit a No link found error when connecting variants - an early version grew its input slots dynamically and the pack has since switched to fixed slots. Update the pack with git pull in the ComfyUI-Momo-Nodes folder and restart.
Inputs (18)
| Name | Type | Default | Description |
|---|---|---|---|
| region | REGION | Bundle from Region Select. | |
| blur | INT | 160β512 | Feather radius for paste edges / masks, in pixels. |
| variantopt | IMAGE | Variant for region 1. | |
| maskopt | MASK | Optional mask for region 1 (white = keep variant). | |
| variant_2opt | IMAGE | β | |
| mask_2opt | MASK | β | |
| variant_3opt | IMAGE | β | |
| mask_3opt | MASK | β | |
| variant_4opt | IMAGE | β | |
| mask_4opt | MASK | β | |
| variant_5opt | IMAGE | β | |
| mask_5opt | MASK | β | |
| variant_6opt | IMAGE | β | |
| mask_6opt | MASK | β | |
| variant_7opt | IMAGE | β | |
| mask_7opt | MASK | β | |
| variant_8opt | IMAGE | β | |
| mask_8opt | MASK | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | β |