ComfyUI Node

NB2 Stitch

NB2 Stitch — the second half that decides whether your edit looks pasted-on

By amortegui84·Created 5 months ago·Updated 3 months ago· 3
NB2 Stitch
  • stitcher
  • inpainted_image
  • image
edge_feather_percent5.0

The whole trick of crop-and-stitch editing is that the crop hides everything you don't want changed, and the stitch is what keeps everything you do want changed from looking like a sticker. NB2 Stitch is that second half: it takes the generated Nano Banana 2 output and composites it back onto the original canvas at exactly the coordinates NB2 Crop recorded.

It's a small node - three required inputs, one output - but the one dial on it is where the "this edit looks seamless vs. this edit looks like a cut-out" line gets drawn.

Inputs and what to do with them

  • stitcher - the coordinate bundle from NB2 Crop. It carries the crop location, size, and the exact target dimensions, so the stitch knows where on the original the generated image belongs and how to downscale it back to the crop's real size. No stitcher, no stitch.
  • inpainted_image - the RGB (or RGBA) output from NB2NanoBanana2Edit. Plain RGB works fine.
  • edge_feather_percent (0–50, default 5) - the knob that matters. It's the percentage of each crop edge that gets a smoothstep feather: 5 means 5% of the width/height on each side fades in. Set it to 0 and you get a hard rectangular cut - useful for debugging, bad for anything you'd show a client. Default 5 is a good starting point; the README's guidance is 3–8 for most jobs, and if Nano Banana shifted the content slightly, a touch more feather hides it.

Output is a single image - the full original with the edit blended in.

One feature worth knowing: if inpainted_image has an alpha channel (RGBA), the alpha is used as an additional blend mask on top of the edge feather. That's how the pack's NB2AddAlpha utility slots in - pre-compute a feathered alpha on the NB2 output and the stitch respects it. If your edited image comes out of a node with a ragged alpha edge, that's the path to a cleaner blend than feathering alone.

The flow

NB2 Mask Generator / NB2 Smart Region -> NB2 Crop
    -> Nano Banana 2 Edit -> NB2 Stitch -> Save / Preview

Install and gotchas

Same pack as the rest: Manager search comfyui-inpaint-cropstitch-nb2, or

cd ComfyUI/custom_nodes
git clone https://github.com/amortegui84/comfyui-inpaint-cropstitch-nb2

then restart. Local node, no API key needed for this step, no models.

The two things that go wrong in practice: (1) you regenerate a different crop after NB2 Crop ran, so the stitcher's coordinates no longer match the new image - rerun the crop, or the paste lands in the wrong spot; (2) a visible rectangle edge that feathering won't fix, which usually means the crop was the wrong aspect-ratio or resolution and the stitch had to resample too aggressively. Check that aspect_ratio / resolution match between NB2 Crop and the mask generator before blaming the feather.

Categoryinpaint/nb2

Inputs (3)

NameTypeDefaultDescription
stitcherSTITCHER
inpainted_imageIMAGE
edge_feather_percentFLOAT5.00–50Percentage of each crop edge to feather (smoothstep). E.g. 5 means 5 %% of width / height on each side. Set to 0 for a hard cut.

Outputs (1)

NameTypeDescription
imageIMAGE