Image Uncrop By Mask
Paste an inpainted crop back cleanly
- destination
- source
- mask
- bbox
- image
This is the "put it back" node. In any crop-inpaint-uncrop workflow - the pattern behind face detailers, region upscalers, and targeted fixes - you cut out a region, do expensive work on just that piece at higher resolution, and then have to composite it back into the full image without a visible seam. Image Uncrop By Mask is the compositing step. It takes your processed crop and lays it into the original at the exact spot it came from, blended through a mask.
It's part of KJNodes, kijai's utility pack, and it's the natural partner to a crop-by-mask/bbox node upstream - you almost never use it alone.
How it works
It needs to know three things: what the full image is, what the new content is, and where it goes. The bounding box handles the "where" - it's the same rectangle you cropped with, so the node knows precisely which pixels to overwrite. The mask handles the blend, deciding how hard or soft the edge between old and new is. Feed it a feathered mask and the seam disappears; feed it a hard-edged one and you'll see the join.
The inputs that matter
All four are required and all four are connections, not sliders - this node has no dials to tweak, it's pure plumbing:
- destination - the full original image you're pasting into.
- source - the processed crop you're pasting in (inpainted, upscaled, whatever you did to it).
- mask - the blend region. This is your seam control; a soft/feathered mask hides the transition.
- bbox - the bounding box that says where the crop lives in the destination. This must be the same bbox produced when you cropped.
The output is a single composited image - the destination with your source blended in.
Installing it
ComfyUI Manager → search KJNodes for ComfyUI → install → restart. Or cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes, then pip install -r ComfyUI-KJNodes/requirements.txt, and restart.
Where people get burned
- Bbox mismatch. The single biggest failure. The bbox here has to be the exact one from the crop step - reuse it, don't rebuild it. A wrong bbox pastes the crop in the wrong place or at the wrong scale.
- Visible seam. A hard-edged mask leaves a rectangle you can see. Feather or blur the mask before this node so the blend is gradual. This is almost always the fix when an otherwise-good detailer looks "stuck on."
- Size drift. If you upscaled the crop, make sure the source lines up with the bbox region the node expects - mismatched dimensions between what was cropped and what you're pasting back cause misalignment. Keep the crop/uncrop pair symmetric.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| destination | IMAGE | — | |
| source | IMAGE | — | |
| mask | MASK | — | |
| bbox | BBOX | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |