ComfyUI Node Runs on cloud

Batch Uncrop

Pasting your processed crops back where they came from

By kijai·Created 3 years ago·Updated about 14 hours ago· 2,930
Batch Uncrop
  • original_images
  • cropped_images
  • bboxes
  • IMAGE
border_blending0.25
crop_rescale1.00
border_toptrue
border_bottomtrue
border_lefttrue
border_righttrue

The detect-crop-refine-paste-back loop is one of the oldest tricks in ComfyUI, and it's the whole reason Impact Pack's FaceDetailer became standard practice: find a region, crop it out, run a fresh sampling pass on it at proper resolution, then paste the result back into the original image. BatchUncrop is that last step - the paste-back - pulled out on its own, as a standalone batch node instead of something baked into an automated detailer.

That matters when your crop-and-process step doesn't happen inside one of those all-in-one detailer nodes. Say you cropped faces out with one tool, ran them through a separate upscaler or face-restore model, and now need to composite the results back onto the originals, in the right place, with a seam that doesn't look like a sticker. That's exactly the gap this node fills.

The inputs that matter

  • original_images (IMAGE, required) - the full, uncropped source images.
  • cropped_images (IMAGE, required) - the processed versions of those crops.
  • bboxes (BBOX, required) - the crop coordinates, in the format most crop/detect nodes emit. This is what tells the node exactly where in each original image its corresponding crop belongs.
  • border_blending (default 0.25, range 01) - how much feathering happens at the seam. This is the one to reach for first if a paste looks obviously composited: raise it before trying anything more elaborate.
  • crop_rescale (default 1, range 010) - if your cropped_images were resized relative to the original crop dimensions (upscaled for a detail pass, say), this tells the node how to scale them back to fit the bbox.
  • border_top / border_bottom / border_left / border_right (default all true) - individually toggle feathering on each edge. Turn off whichever edge sits flush against the source image's own border, since there's nothing on the other side of that edge to blend against.

Output: IMAGE - the composited batch, same shape as original_images.

How to install it

Via ComfyUI Manager: search KJNodes for ComfyUI, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-KJNodes
pip install -r ComfyUI-KJNodes/requirements.txt

Then restart. Pure image compositing - no models to download.

Common issues & troubleshooting

Crops end up pasted onto the wrong image, or in the wrong spot. This is a batch node, and it expects original_images, cropped_images, and bboxes to line up index-for-index. A mismatch in batch order or count between the three is the single most common way this silently composites the wrong thing - check your batches are aligned before chasing anything else.

The seam is visibly obvious. Raise border_blending first - that one float is doing the feathering work, and it's usually enough on its own before you touch anything else.

A crop near the edge of the source image looks wrong or has a dark/blank border. Check whether the corresponding border_* toggle is on for an edge that's flush against the image boundary - the node will try to feather-blend against content that doesn't exist there. Turn that specific edge's toggle off.

The pasted region looks the wrong size relative to the original crop area. That's crop_rescale - if you upscaled or downscaled the crop during processing, this needs to reflect that so the node scales it back to fit the bbox correctly.

CategoryKJNodes/masking

Inputs (9)

NameTypeDefaultDescription
original_imagesIMAGE
cropped_imagesIMAGE
bboxesBBOX
border_blendingFLOAT0.250–1
crop_rescaleFLOAT1.000–10
border_topBOOLEANtrue
border_bottomBOOLEANtrue
border_leftBOOLEANtrue
border_rightBOOLEANtrue

Outputs (1)

NameTypeDescription
IMAGEIMAGE