Nodes/ComfyUI-CustomNodePacks/Inpaint Paste Back
ComfyUI Node

Inpaint Paste Back

Inpaint Paste Back for clean crop-and-stitch

By Code2Collapse·Created 6 months ago·Updated a day ago· 52
Inpaint Paste Back
  • stitcher
  • inpainted_image
  • image
  • info
upscale_methodbicubic
feather_edgesfalse
feather_radius16

Inpaint Paste Back is the "keep it simple" half of the pack's crop-and-stitch inpaint pipeline. It does exactly what it says: takes the inpainted crop from Inpaint Crop Pro, resizes it back to the original coordinates, and pastes it onto the untouched original - optionally feathering the rectangle's edge so the boundary isn't a hard cut. No blend pipeline, no frequency-domain seam hiding, no color matching. Just resize, place, optionally soften the edge.

That simplicity is a feature, not a downgrade. The crop-and-stitch pattern's core promise - from lquesada's original work - is that the unmasked pixels never pass through a model or a VAE, so they stay pixel-perfect. Paste Back is the fastest, most deterministic way to honor that promise. When your mask region is a clean rectangle (or the inpaint was already generous with its edges), you don't need a $200-blend-pipeline to hide a seam that barely exists.

It's part of the C2C/Inpaint suite in ComfyUI-CustomNodePacks, the ~72-node pack from Code2Collapse (Likhith-24, active on r/comfyui).

How it works

Two inputs carry the whole operation:

  • stitcher - the data dict from Inpaint Crop Pro that remembers exactly where the crop came from, its size, and how to map it back. This is why you must keep the crop node's stitcher output wired.
  • inpainted_image - the result of your sampler on the crop.

Then it resizes the inpainted crop to the original crop's size using upscale_method (lanczos, bicubic, bilinear, nearest, or area) and places it back. The one quality knob: feather_edges (default off) with feather_radius (default 16) applies a Gaussian feather at the crop boundary - the cheap version of a blend. Turn it on when your inpaint doesn't perfectly match the surrounding pixels and you get a soft transition instead of a visible rectangle edge.

Outputs are image (the final composited frame) and info (a string).

When to pick Paste Back over Stitch Pro

| Situation | Use | |---|---| | Clean rectangular mask, inpaint matches surroundings | Paste Back - fast, deterministic | | Complex mask shape, visible seam risk, textured background | Stitch Pro - Laplacian/edge-aware/FFT blending | | Video with jittery masks | Stitch Pro with temporal smoothing |

The pack's own framing (in its README and docs) says the same: Paste Back is the clean resize-and-paste, Stitch Pro is the pro seam-hiding option. For a quick region fix - removing an object, swapping a sky - Paste Back with feathering on is usually all you need.

Installing it

Ships in ComfyUI-CustomNodePacks. ComfyUI Manager → search "CustomNodePacks", or:

cd ComfyUI/custom_nodes
git clone https://github.com/Code2Collapse/ComfyUI-CustomNodePacks.git

Needs the pack's standard deps (opencv-python>=4.7.0, scipy>=1.10.0) - install just what's missing, not the full requirements.txt, which can clobber ComfyUI's torch. No models. Restart ComfyUI.

Common issues

  • "stitcher" errors - you wired the crop node's stitcher into a node that expected something else, or the crop node didn't run. The stitcher dict is opaque data; just keep it flowing crop → sampler → this node.
  • Hard rectangle edge visible - turn on feather_edges and raise feather_radius. If that's not enough, the region needs real blending, which means Stitch Pro, not this node.
  • Blurry result - upscale_method matters. lanczos for quality, nearest only if you're being sloppy or it's pixel art. If the blur is in the inpaint itself, the crop resolution was too low at sampling time.

The honest take: this node is deliberately boring, and that's its virtue. When the internet's deepest seam-hiding wizardry is overkill for a rectangular region fix, you want exactly this - deterministic, fast, and easy to reason about.

CategoryC2C/Inpaint

Inputs (5)

NameTypeDefaultDescription
stitcherSTITCHERStitcher dict from InpaintCropProMEC
inpainted_imageIMAGEInpainted crop result (B,H,W,C)
upscale_methodCOMBObicubicInterpolation method for resizing crop back
feather_edgesBOOLEANfalseApply Gaussian feather at crop boundary
feather_radiusINT160–64Feather radius in pixels (only used if feather_edges)

Outputs (2)

NameTypeDescription
imageIMAGE
infoSTRING