Nodes/ComfyUI_pytorch360convert/Paste Image with Coords
ComfyUI Node

Paste Image with Coords

Stitch your edited region back into the original — bit-identical everywhere you didn't touch

By ProGamerGov·Created 2 years ago·Updated 11 months ago· 37
Paste Image with Coords
  • full_image
  • cropped_image
  • coords
  • Pasted Image

This is the second half of the pack's crop-and-edit trick. Crop Image with Coords cuts a region out of an image so you can inpaint or upscale just that part (small region = fast, and it fits in the model's native resolution budget); Paste Image with Coords puts the edited region back into the original, and leaves every pixel you didn't touch exactly as it was. If the crop node is the "take it apart" node, this is the "put it back together" node.

Why does that matter? Because whole-image editing drifts - an edit model or a high-denoise pass tends to shift things you didn't ask to change. Mask-based, region-based editing is the one way to get edits where nothing else moves. The knowledge base's inpainting essay makes exactly this point: composite the edited region back and the rest of the frame is bit-identical. That's the whole value proposition here.

How it works

It takes the original image, the edited crop, and the coordinates from the crop node, then writes the crop back into the original at those coordinates. It's a slice-and-assign in torch - no resampling, no blending, nothing clever. If the crop is smaller than the region you're pasting into (or vice versa), you get a shape mismatch, so the coord list needs to be the exact one Crop Image with Coords produced.

Inputs:

  • full_image - the original image you want the edit merged back into.
  • cropped_image - the region you processed (inpainted, upscaled, whatever).
  • coords - a LIST of four ints, [start_h, end_h, start_w, end_w]. This is exactly what Crop Image with Coords outputs as its Coords output, so the standard wiring is: original → Crop → [process the crop] → Paste, with the Coords socket from Crop fed straight into Paste.

Output is the single Pasted Image, ready to save or continue downstream.

The workflow in practice

For a 360 pano from this pack, the pattern people actually use is: crop the seam region, rotate/patch it, paste it back, and then handle the rest with the mask nodes. For ordinary images, it's the classic "fix the eyes without touching the hair" pattern - crop tight, inpaint at high resolution, paste back, and the hair is untouched down to the pixel. Pairing Crop + Paste means you can upscale a 1024×1024 region at full quality while the rest of a 4K image stays exactly as-is.

One subtle thing to know: the paste writes into the full_image tensor in place. In normal ComfyUI use that's invisible - nodes run once and the result is the output. But it means you shouldn't plan on reusing the same full_image upstream later expecting it unchanged; if you need the pristine original again, wire a fresh load.

Install

Same pack install as everywhere else: ComfyUI Manager → search "ComfyUI_pytorch360convert", or git clone https://github.com/ProGamerGov/ComfyUI_pytorch360convert into ComfyUI/custom_nodes and restart. The requirements.txt is empty so python -m pip install pytorch360convert is often needed by hand. No model downloads - this node is just tensor slicing, so it runs instantly even on CPU.

Categorypytorch360convert/miscellaneous

Inputs (3)

NameTypeDefaultDescription
full_imageIMAGE
cropped_imageIMAGE
coordsLIST

Outputs (1)

NameTypeDescription
Pasted ImageIMAGE