Nodes/MTB Nodes/Uncrop (mtb)
ComfyUI Node Runs on cloud

Uncrop (mtb)

Paste a processed crop back into the full image in ComfyUI

By melMass·Created 3 years ago·Updated about a month ago· 723
Uncrop (mtb)
  • image
  • crop_image
  • bbox
  • IMAGE
border_blending0.25

Uncrop is the other half of a crop. You cut a region out of an image, did something to just that region - upscaled it, re-diffused it, fixed a face - and now you need to put it back where it came from, seamlessly. Uncrop (mtb) does that: it takes the full image, the processed crop, and the bounding box it came from, and pastes the crop back in with feathered edges so the seam disappears.

This is the backbone of the classic detail-fix pattern. Big image, small area that needs work: crop it out, blow it up and re-render it at high resolution, then uncrop it back into place. Doing the heavy work on just the crop is far cheaper than re-rendering the whole frame, and Uncrop is what makes the result look like it was always there instead of a rectangle pasted on top. If you've used detailer or inpaint-and-stitch workflows, this is the "stitch back" step, exposed as its own node.

It's in the crop section of MTB Nodes (comfy_mtb) by melMass.

How it works

You give it the original image, the (usually modified) crop, and a bounding box saying where that crop belongs. It places the crop at those coordinates and blends the border so the edge between old and new pixels feathers out instead of showing a hard line. The bounding box can be a plain (x, y, width, height) tuple or a proper BBOX value - and per the node's own docs, if you provide both, the BBOX input wins.

The inputs and outputs that matter

  • image - the full original image you're pasting back into.
  • crop_image - the processed crop to place. Whatever you did to the cropped region, this is the result.
  • bbox (BBOX) - where the crop goes. In practice you get this straight from the crop node that cut the region in the first place, so the coordinates line up automatically.
  • border_blending (default 0.25, range 0–1) - how much the edges feather. Higher blends over a wider band for a softer, more invisible seam; lower keeps the pasted region sharper-edged. This is the dial you actually tune to hide the join.

Output is a single IMAGE - the full frame with your processed region blended back in.

How to install it

ComfyUI Manager: search MTB Nodes, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/melMass/comfy_mtb

then restart. Pure Python - no models, no heavy dependencies.

Common issues & troubleshooting

The crop landed in the wrong place. Almost always a bbox mismatch. Use the same bounding box that produced the crop - feed the crop node's bbox straight into Uncrop rather than typing coordinates by hand. And remember: if you wire both a tuple and a BBOX, the BBOX takes precedence, so a stray BBOX input can override the coordinates you thought were being used.

A visible seam or box edge. That's border_blending too low. Raise it so the border feathers over a wider band and the transition disappears. If the crop's color or lighting doesn't match the surroundings, no amount of blending fully hides it - match the processing so the crop belongs there.

The crop was resized and now doesn't fit. If you upscaled the crop, it has to be scaled back to the bbox's size before (or as) it's pasted - an oversized crop won't drop cleanly into a smaller box. Keep the crop's final dimensions consistent with the region it's filling.

Blending bleeds into detail you wanted sharp. Very high border_blending softens a wide margin, which can smear detail near the edge of the region. Dial it back to the smallest value that still hides the seam.

Categorymtb/crop

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
crop_imageIMAGE
bboxBBOX
border_blendingFLOAT0.250–1

Outputs (1)

NameTypeDescription
IMAGEIMAGE