ComfyUI Node

Seamless Clone

Poisson Blending in ComfyUI

By Aksaz·Created 2 years ago·Updated 11 months ago· 20
Seamless Clone
  • source_image
  • destination_image
  • mask_image
  • cloned_image
blend_mode
center_x0
center_y0

If you've ever cut a face, a building, or a prop out of one image and pasted it onto another, you know the telltale sign: a hard edge that screams "this was composited." The Seamless Clone node is the fix for that. It wraps OpenCV's seamlessClone - Poisson blending, from the 2003 Pérez/Gangnet/Blake paper - so your patch doesn't just sit on top of the background, it actually borrows the background's lighting and gradients. On r/comfyui, someone assembling reference photos by cutting pieces from different images got pointed at exactly this node, and that's the whole use case in one sentence: "What you really want is a Poisson Blend."

The naive alternative is a plain mask composite - ImageCompositeMask or a straight alpha blend - and it's fine until the edge shows. Poisson blending does something cleverer: instead of copying the source's pixel colors, it copies the source's gradients and re-integrates them into the destination, so the seam vanishes because the luminance and color differences are spread across the whole patch. Seamless Clone gives you that math as a regular Image Processing node, no API, no key, nothing exotic.

How it works

Feed it three things and it does the rest. The source image and mask get resized to the destination's dimensions (so mismatched proportions won't crash it - it just stretches them), the mask is forced to a clean binary, and then it hands everything to OpenCV. One quirk from the source worth knowing: if center_x and center_y are both 0, the node auto-picks the geometric center of the mask's bounding box. Any other value is treated as a real center, which means it translates the entire source image to line that point up - so don't expect a 0,0 center to mean "top-left corner." It doesn't. It means "figure it out for me."

Batch size is hard-capped at 1, which is fine for a compositing node but worth knowing before you pipe a whole folder through it.

The inputs that matter

  • source_image - the thing you're cloning in (foreground).
  • destination_image - the background it lands on.
  • mask_image - a MASK (single-channel, 0–1) marking the region to clone.
  • blend_mode - the one dropdown that actually changes behavior:
    • NORMAL_CLONE - standard seamless blend, best for matching a patch's look to the background.
    • MIXED_CLONE - preserves the source's own gradients; reach for it when the source and destination have very different textures or the patch has detail you don't want flattened.
    • MONOCHROME_TRANSFER - transfers the source's texture into the destination's colors. It's for copying patterns/material, not cut-and-paste of content.
  • center_x / center_y - leave both at 0 for auto-center (the default and usually what you want).

The single output is cloned_image (IMAGE), which wires straight into a Save Image or anything downstream that takes an image.

Installation

Via ComfyUI Manager, search "seamless-clone-comfyui" and hit install. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/Aksaz/comfyui-seamless-clone
pip install -r requirements.txt

Then restart ComfyUI. Two things to eyeball: the requirements pin numpy==2.2.0, opencv_python==4.10.0.84, and torch==2.5.1. ComfyUI already ships numpy and torch, and a torch pin can fight your existing install - if you get torch errors, skip the pinned version and just pip install opencv-python into your ComfyUI venv. As with any custom node from a small repo, the code here is short and readable (one file), so give it a skim before trusting it with your setup - there's no review process protecting you by default.

Common issues

  • "Mask is empty after processing" / "No valid mask pixels found" - your mask is all zeros or fully outside the image. Make sure it has actual non-zero content over the region you're cloning; the node also erases any mask pixels that fall outside the destination bounds, so a mask bigger than the image silently loses its edges.
  • The output looks like a plain blend, not a seamless clone - that's the built-in fallback kicking in when OpenCV's solver fails (the README calls it normal behavior for complex geometry). It still outputs an image, just without the Poisson magic. MIXED_CLONE survives more cases than NORMAL_CLONE when gradients get complicated.
  • Images arrive stretched - the node resizes source and mask to the destination size, so wildly different aspect ratios get distorted. Keep your inputs near the same proportions.

Is it the most exciting node in your graph? No. But when you need a patch to actually belong in its background, it's the difference between a collage and a photograph.

CategoryImage Processing

Inputs (6)

NameTypeDefaultDescription
source_imageIMAGE
destination_imageIMAGE
mask_imageMASK
blend_modeCOMBO3 options: NORMAL_CLONE, MIXED_CLONE, MONOCHROME_TRANSFER
center_xINT00–8192
center_yINT00–8192

Outputs (1)

NameTypeDescription
cloned_imageIMAGE