Image Uncrop By Bound
Put the regenerated bit back without the seam — Image Uncrop By Bound
- target
- target_bounds
- source
- IMAGE
This is the "put it back" half of the crop-and-uncrop trick, and it's the half that keeps you from ruining a good image. The workflow: you crop a region out, fix it (inpaint it, regenerate it, upscale it), and then you need the fixed patch to land back in the original image at the exact same spot, blended so nobody can see where the surgery happened. wcx_ImageUncropByBound does that, and it's the natural pair to Image Crop By Mask from the same pack, which hands you the crop and the coordinates in one go.
The mechanism is exactly what the inputs imply. You give it the target (the full, untouched image), the target_bounds (the rectangle the crop came from, in the [rmin, rmax, cmin, cmax] format Image Crop By Mask outputs), and the source (your regenerated patch). For each source image it looks up its bounds, resizes the patch to the bounds box with Lanczos, pastes it into position, and composites it over the target using a feathered alpha mask - a Gaussian-blurred edge whose radius is your feathering value (default 16). The blend_factor (0–1, default 1.0) scales that mask, so at 1.0 the patch fully replaces the old pixels and at something like 0.5 you get a semi-transparent blend of old and new. Dialing it below 1.0 is a cheap way to soften a strong edit when a full swap looks pasted-on.
Feather the edges and this node does the regional-detail loop from the KB automatically: crop → regenerate the region on its own denoise → uncrop back. That's the same pattern ADetailer-style detailing runs, minus the detector.
Where people get burned:
- Bounds must come from the same image you're targeting. The patch is resized to fit whatever rectangle the bounds describe, so if the target or bounds are from a different resolution, your patch gets squashed and won't line up. Keep target, source, and bounds as one family.
- Feathering auto-clamps. The code caps the blur radius at half the region's smaller dimension, so a tiny crop physically can't get a soft edge. If you want a gentle seam on a small patch, feathering 16 is already hitting its ceiling - accept the hard-ish edge or work bigger.
- Batch pairing is lenient to a fault. If you feed more sources than bounds, it reuses the first bound for the extras instead of erroring. That's a silent misalignment, so match your counts.
One IMAGE comes out. Feed it straight into a preview or save node - the uncrop is the last step of the loop.
Installing is the standard two ways, and this pack is light: no requirements file, no model downloads, just drop it in.
# ComfyUI Manager: Custom Nodes Manager → search "ComfyUI-Practical-Tools" → Install → restart
# or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/wenchengxiang/ComfyUI-Practical-Tools
# restart ComfyUI
One honest caveat: the pack README is a single sentence, so the source code is the documentation. This node is pure Pillow + torch - nothing exotic to break.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| target | IMAGE | — | |
| target_bounds | IMAGE_BOUNDS | — | |
| source | IMAGE | — | |
| blend_factor | FLOAT | 1.000–1 | — |
| feathering | INT | 160–999999 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |