Nodes/ComfyUI-Loop/♾️ Paste Image
ComfyUI Node

♾️ Paste Image

The 'paste it back' half of crop-and-stitch inpainting

By Hullabalo·Created 2 years ago·Updated 7 months ago· 14
♾️ Paste Image
  • source
  • cut
  • cut_mask
  • image
x0
y0

If you've ever inpainted the good way - crop a tiny region, regenerate it at native resolution, then glue it back - you know the glue is where things fall apart. Paste Image (ImagePasteLoop) is the glue. It's the second half of the ComfyUI-Loop pack's crop-and-paste pair, and its only job is taking the cut from ♾️ Image Crop and putting it back onto the source at exactly the x,y it was cut from, optionally blended through a mask. Nothing else in the image moves. That's the entire reason mask-based inpainting still beats whole-frame edit models in 2026: the unmasked pixels come back byte-identical, and this node is what enforces that rule for you instead of trusting you to remember it.

How it works

The paste is a tensor slice, not a VAE round trip. Under the hood (paste_and_forget) the node clamps your coordinates so the cut stays inside the source, then writes the cut pixels straight into the source tensor. No encode, no decode, no model pass. When you don't provide a cut_mask - or the mask is all zeros - it's a hard pixel replace. When you do provide one, it normalizes the mask and does an alpha blend, cut * mask + original * (1 - mask), so feathered mask edges give you a soft seam instead of a hard rectangle. Fast, and it never drifts a pixel you didn't ask it to touch.

The inputs that matter

Only a few, and you rarely type them - the node is built to be wired from Image Crop:

  • source - the base image you're pasting onto.
  • cut - the segment to paste. Comes straight from Image Crop's cut output.
  • x and y - INT, default 0, step 8, max 16384. Note they're forceInput in the schema: the author intends them to be connected, not hand-typed, so the natural graph is Crop → Paste, feeding x, y, cut, and cut_mask across in one bundle. You basically never set these by hand.
  • cut_mask (optional) - "Optional cutting mask." Feed Image Crop's cut_mask output here and the pasted region blends along its edges instead of landing as a hard square.

Output: a single image - the composited result. Wire it to a preview node or into Save Any to finish the loop.

Why you'd reach for it

This is the "paste" in the crop-and-stitch pattern the KB calls the 2026 default for inpainting: crop a small region, render it at the model's native resolution, stitch it back. It's also the honest alternative to ImageCompositeMasked when you already have an aligned cut and mask from a crop node - one wire, no fiddling with latent compositing. For manual iterative fixing - fix the eye, run, look, fix again - pairing it with the Loop pack's Save Any / Loop Any gives you a feedback loop where the composited result keeps feeding the next pass.

Install

No dependencies, no model downloads. ComfyUI Manager: search "Loop" and install ComfyUI-Loop, then restart. Or the manual route:

cd ComfyUI/custom_nodes
git clone https://github.com/Hullabalo/ComfyUI-Loop

Restart ComfyUI. That's it - the whole pack is four nodes, all MIT.

Common gotchas

  • Paste region size is whatever the cut is. There's no auto-resize. If you regenerate the crop at a different size than Image Crop produced - say you upscaled it first - the patch won't line up, and you'll get the same "slightly misaligned" look people complain about with whole-frame editors, just at paste time. Keep the cut at the size the crop node made it, and let x/y/size flow through untouched.
  • Coordinates clamp silently. If x,y push the cut past the image edge, the node clips the pasted area to the source bounds instead of erroring. That's the first time a patch "just ends" mid-image, it's this.
  • Mask resolution matters. Image Crop resizes its input mask to match the image, so a mask from anywhere else at a different resolution will have misaligned edges. Feed the crop's own cut_mask output and it lines up by construction.
  • Not compatible with Nodes 2.0 (ComfyUI's new Vue-based frontend). The pack is tested through ComfyUI 0.8.2 with the legacy canvas; on Nodes 2.0, expect breakage. If you're on the new frontend, this is the dealbreaker to know about before installing.
CategoryLOOP

Inputs (5)

NameTypeDefaultDescription
sourceIMAGE
cutIMAGE
xINT00–16384
yINT00–16384
cut_maskoptMASKOptional cutting mask.

Outputs (1)

NameTypeDescription
imageIMAGE