Nodes/ComfyUI-InpaintEasy/Image Crop Merge
ComfyUI Node

Image Crop Merge

Paste your inpainted crop back into the original image

By CY-CHENYUE·Created 2 years ago·Updated 2 years ago· 93
Image Crop Merge
  • cropped_image
  • original_image
  • IMAGE
crop_x0
crop_y0
cropped_original_width512
cropped_original_height512
resize_methodlanczos

What it is

This is the back half of ComfyUI-InpaintEasy's crop → inpaint → merge pattern - the node that undoes Crop By Mask. You cropped a region out, ran it through your inpaint sampler, and now you need it back in the original frame, at the right spot, at the right scale, without touching a single pixel outside that region. This is the whole reason the crop-and-stitch approach exists in the first place: the community's oldest inpainting rule is "composite your result back, don't just decode the whole canvas again," because every VAE round-trip degrades the parts of the image you never meant to touch. This node is that compositing step.

How it works

Feed it your processed crop and the original full image, plus the coordinates that describe where the crop came from. It resizes the processed crop back to its pre-sampling size and pastes it into the original image at that exact location. Worth knowing plainly: there's no mask input here. This node takes x/y coordinates and dimensions, not a feathered mask, so the paste is a straightforward rectangular composite. If you want the seam to blend rather than show a hard edge, that softness has to already be baked in - via mask blur upstream in Image and Mask Resize, or by keeping your crop's padding generous back in Crop By Mask so the edges land in visually similar territory rather than right at a sharp content boundary.

The inputs and outputs that matter

  • cropped_image - your processed result, straight out of the sampler.
  • original_image - the full, untouched source image you're pasting back into.
  • crop_x / crop_y - where the crop was taken from, 0 to 4096. In the normal chain these come straight from Crop By Mask's matching outputs - don't hand-type these unless you're doing something custom.
  • cropped_original_width / cropped_original_height - the size to scale the processed crop back to before pasting, 1 to 4096 each. These pair with the original_width/original_height that Crop By Mask outputs; wire them straight across.
  • resize_method - same five options as the pack's other resize step (nearest-exact, bilinear, area, bicubic, lanczos, default lanczos). Lanczos is the safe default for photographic content.

Output is a single IMAGE - the full-size original with your inpainted region pasted back in, ready for the next stage of your workflow or straight to a Save Image node.

Installing it

ComfyUI Manager: search "ComfyUI-InpaintEasy" and install. Manual install:

cd ComfyUI/custom_nodes
git clone https://github.com/CY-CHENYUE/ComfyUI-InpaintEasy

Restart ComfyUI. No models involved here either - it's the merge/paste step, plain image compositing against coordinates you already have from earlier in the graph.

Common issues

Visible hard edge where the crop meets the rest of the image. Expected if the mask feeding your sampler had no blur and your crop padding was tight - this node does a rectangular paste, it doesn't feather anything on its own. Go back to Image and Mask Resize and raise mask_blur_radius, or increase padding on Crop By Mask so the crop edge lands somewhere less visually jarring.

Pasted region is offset from where it should be, or wrong size. Almost always a coordinate mismatch - crop_x/crop_y/cropped_original_width/cropped_original_height need to be the exact values Crop By Mask produced for that same crop, unmodified. If anything in between resized the image without carrying these numbers along, the math breaks.

Result looks slightly different in style or tone from the rest of the image. That's not this node - it's the sampler stage upstream. If your inpaint model or settings drift from the surrounding image's look, dial denoising strength down or match your CFG to the main generation before it ever reaches this node; the merge step just places pixels, it doesn't correct style.

CategoryInpaintEasy

Inputs (7)

NameTypeDefaultDescription
cropped_imageIMAGE
original_imageIMAGE
crop_xINT00–4096
crop_yINT00–4096
cropped_original_widthINT5121–4096
cropped_original_heightINT5121–4096
resize_methodCOMBOlanczos5 options: nearest-exact, bilinear, area, bicubic, lanczos

Outputs (1)

NameTypeDescription
IMAGEIMAGE