Nodes/ComfyUI-ImageProcessUtilities/Paste Image by Coords
ComfyUI Node

Paste Image by Coords

Paste image by coords — alpha-composite your crops back in, seams optional

By einhorn13·Created about a year ago·Updated about a year ago· 1
Paste Image by Coords
  • base
  • inserts
  • coords
  • mask
  • IMAGE
x_coords_str
y_coords_str
feathering8

Paste Image by Coords (class PasteByCoords) is the paste-back half of the crop-and-stitch pipeline. CropByCoords grabs a region, you render it somewhere with more resolution and attention, and this node drops the result back onto the original image at the same spot - with a soft, blended edge so the repair doesn't announce itself.

This is the "only-masked detail at full resolution" inpainting pattern in physical form: crop a small region, run it at the model's native resolution, paste it back. A 64px face feature gets 1024px of generation budget, and the surrounding image stays pixel-for-pixel untouched. It's also just a decent general compositing tool - montages, swapping a region, dropping a rendered element onto a background.

How it works. It alpha-composites inserts over base at each coordinate: for every insertion, it takes the insert, multiplies it by a blending mask, and mixes it with the base using base * (1 - mask) + insert * mask. So the mask controls how much of the insert shows through at each pixel, and the node handles the math so edges blend rather than stack.

Where the seam control comes from is the interesting part, and you get two ways:

  • A mask input. Any mask you like. If it's a different size than the insert, it's resized to match with bilinear interpolation. This is your power tool - hand-drawn soft masks, or a mask generated elsewhere in the graph, give you full control over what blends and what doesn't.
  • feathering (default 8). If no mask is provided, the node builds a linear fade across the first and last feathering pixels of every edge. Set it to 0 for hard, cut-out edges; crank it up to melt the boundary into the background.

Coordinates work the same as the crop node: a COORDS input, or x_coords_str/y_coords_str as comma-separated strings. One difference worth noting: with no coordinates at all it defaults to pasting at (0, 0) - top-left - rather than no-opping, so a bare PasteByCoords still does something. Inserts and coords cycle if their lists are shorter than the base batch, and pastes that land fully outside the image are skipped.

The inputs that matter. Required: base and inserts. Optional: coords, mask, x_coords_str, y_coords_str, feathering. Output is the composited IMAGE.

Install. Standard for this pack - no dependencies, no model downloads:

cd ComfyUI/custom_nodes
git clone https://github.com/einhorn13/ComfyUI-ImageProcessUtilities

Restart ComfyUI. Manager search may not find it (it's not on the official registry yet), so the clone is the safe bet.

Common issues. The feathering edge is uniform on all four sides - if you want the top edge crisp and the bottom feathered, you need a mask, not feathering. And remember mask overrides feathering entirely; if you feed both and get unexpected hard edges, it's the mask winning.

Categoryimage/transform

Inputs (7)

NameTypeDefaultDescription
baseIMAGE
insertsIMAGE
coordsoptCOORDS
maskoptMASK
x_coords_stroptSTRING
y_coords_stroptSTRING
featheringoptINT80–1024

Outputs (1)

NameTypeDescription
IMAGEIMAGE