ComfyUI Node

Uncrop Image

Put the processed crop back where it came from — with feathered edges, not a hard rectangle

By Pirog17000·Created about a year ago·Updated 10 months ago· 3
Uncrop Image
  • original_images
  • cropped_images
  • bboxes
  • IMAGE
blend_width16

Every crop-and-process workflow ends the same way: you've fixed up a region in isolation, and now you have to put it back into the original image - with a seam that doesn't scream "I pasted this." Uncrop Image is the paste step. Give it the originals, the processed crops, and the bboxes from the crop node, and it blends each crop back in with a feathered edge instead of a hard rectangle. It's the node that makes the pack's crop-uncrop pipeline actually usable.

How it works

For each pair it takes the bbox (x, y, w, h), slices that region out of the original, and lays the processed crop into it. Two details make it work well:

  • It resizes the crop to match the bbox region exactly. This matters because if your crop went through a sampler or VAE round-trip, its dimensions may have drifted a few pixels - the node normalizes before pasting rather than complaining.
  • The blend_width input (default 16) creates a feathered edge mask: a band around the region's border where the pasted crop fades from the processed pixels to the original pixels. At blend_width: 0 you get a hard paste; anywhere above that, soft edges. That gradient is the difference between "fixed seamlessly" and "visible rectangle."

It also clamps bbox coordinates to the original image's bounds, so a slightly oversized bbox from an earlier step won't crash - it just trims.

The inputs that matter

  • original_images - the untouched originals.
  • cropped_images - your processed crops.
  • bboxes - (x, y, w, h) per crop, straight from Crop From Mask (BatchCropFromMaskSimple).
  • blend_width - feather width in pixels. 16 is a good default; raise it for softer transitions on large regions.

Output: IMAGE - the composited result.

The full pipeline

For the complete flow: Crop From Mask → process (img2img, upscale, inpaint, whatever) → Uncrop Image. You can add Crop Mask by BBox if you need a mask to match your processed crop. This is a solid alternative to full-frame editing for fixing one region - the rest of the image stays untouched, which masked-inpainting fans will recognize as the classic "only-masked detail at full resolution" move.

Installing it

Part of Pirog's Nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/Pirog17000/Pirogs-Nodes
pip install -r Pirogs-Nodes/requirements.txt

Or ComfyUI Manager → "Pirog's Nodes" → restart.

Gotchas

Keep the bboxes flowing straight from the crop node - mixing bbox conventions between packs is the fastest way to get crops landing in the wrong place (this one expects (x, y, w, h) like the rest of the pack). And don't expect a miracle at high denoise: the feathered edge hides the transition, but if your processed crop is wildly different in color or lighting from the original, you'll still see a soft boundary. If the region is at the image edge, blend_width feathered bands at the actual borders are ignored by design - that's expected, not a bug.

Categorypirog/image

Inputs (4)

NameTypeDefaultDescription
original_imagesIMAGE
cropped_imagesIMAGE
bboxesBBOX
blend_widthINT160–256

Outputs (1)

NameTypeDescription
IMAGEIMAGE