Nodes/ComfyUI_Nimbus-Pack/Image Combine Rect
ComfyUI Node

Image Combine Rect

Paste a patch back into an image at a chosen corner

By sergekatzmann·Created 3 years ago·Updated 8 months ago· 7
Image Combine Rect
  • destination_image
  • source_image
  • image
corner

This is the other half of the pair. Where Image Extract Rect cuts a rectangle out of a corner, this node pastes one back in. You give it a destination image, a source patch, and a corner, and it stamps the patch onto that corner of the destination. In the menu it's Image Combine Rect.

On its own it's a corner paste; in practice it's the closing move of an extract-process-recombine workflow. Pull a region out with Image Extract Rect, run something on just that region - a targeted upscale, a cleanup pass, a watermark removal - and drop it back in place with this. The rest of the image is never touched, which is the whole appeal.

How it works

The source_image (the patch) is placed onto the destination_image at the specified corner, aligned to that corner. top-left pins the patch's top-left to the destination's top-left; bottom-right pins it to the bottom-right; the other two do the corresponding thing. It's a straight paste at the patch's own size - the patch overwrites whatever destination pixels it covers.

The inputs and outputs that matter

  • destination_image - the full image you're pasting into.
  • source_image - the patch to paste (usually one that came out of Image Extract Rect).
  • corner - where to place it: top-left, top-right, bottom-left, or bottom-right.

Output: a single image - the destination with the patch composited in.

Installing it

ComfyUI Manager: search ComfyUI_Nimbus-Pack, install, restart. Small pack, so if the registry doesn't have it, clone it:

cd ComfyUI/custom_nodes
git clone https://github.com/sergekatzmann/ComfyUI_Nimbus-Pack.git
pip install -r ComfyUI_Nimbus-Pack/requirements.txt

Restart. Pure PIL/NumPy, no models. The requirements.txt is for the pack's video node.

Common issues & troubleshooting

The patch doesn't line up. This is the number-one gotcha, and it comes from changing the patch's size between extract and combine. The paste anchors to a corner at the source patch's current dimensions - so if you extracted a 256x256 region, upscaled it to 512x512, then combined, the bigger patch covers more area and no longer matches its origin. Resize the processed patch back to the extracted size before this node, or keep the size fixed throughout.

Visible seams. It's a hard paste, not a feathered blend - there's no edge blending or masking here. If you altered the patch's colors or brightness (say, an auto-levels pass on just that region), the boundary can show. Keep whatever you do to the patch tonally consistent with the rest of the image, or plan for a seam.

Use the same corner for both nodes. If you extracted from top-right, combine to top-right. Mismatched corners paste the patch somewhere it never came from.

You need placement other than a corner. Like its sibling, this node only anchors to the four corners - no free x/y offset. For arbitrary positioning you'll want a general composite/paste node.

CategoryNimbus-Pack/Image

Inputs (3)

NameTypeDefaultDescription
destination_imageIMAGE
source_imageIMAGE
cornerCOMBO4 options: top-left, top-right, bottom-left, bottom-right

Outputs (1)

NameTypeDescription
imageIMAGE