Poisson Blend (Yogurt Nodes)
Compositing that makes the pasted object stop looking pasted
- background
- foreground
- mask
- blended
A plain copy-paste of one image onto another always shows the seam - different lighting, different color cast, a hard edge that screams "edited." Poisson Blend (Yogurt Nodes) is the fix: it runs OpenCV's seamlessClone on the foreground and background so the pasted object's colors and gradients are solved to blend into its new surroundings. The result is the "how did you paste that so seamlessly" effect, done as a graph node.
It's the compositing cousin of the pack's inpainting tooling: after you inpaint a region or cut out an object with a background-removal workflow, Poisson blending is how you land it back on a scene without a visible boundary. The node exists to solve the seam problem - lighting and color math carried across the paste boundary - rather than just stacking pixels.
How it works
Under the hood it's one OpenCV call: cv2.seamlessClone(fg, bg, mask, center, cv2.NORMAL_CLONE). The node takes your background and foreground images plus a mask, then: crops the foreground down to the mask's bounding box, resizes that crop to your requested width × height, and pastes it centered on (x + width/2, y + height/2) - so x/y are the top-left of the paste area, not its center. NORMAL_CLONE is the blend mode: it preserves foreground texture while transferring the background's illumination, which is exactly the "fix the lighting" behavior you want for compositing. It works on the first frame of each input batch and returns a single blended image.
The inputs that matter
background- the base image you're pasting onto.foreground- the object to paste in.mask- roughly where the object is; the node auto-crops to its bounding box, so it doesn't need to be pixel-perfect.x/y- top-left corner of the paste destination.width/height- the size to scale the cropped foreground to. These default to 0, and 0 is not valid - the resize will fail. Set them to the size of your paste area.
One output: blended - the composited image.
Installing it
It's part of ComfyUI-YogurtNodes. Install via ComfyUI Manager (search "ComfyUI-YogurtNodes") or:
cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes
pip install -r requirements.txt
Restart ComfyUI; it's under "Yogurt Nodes".
Where people get burned
The big one: Poisson Blend needs OpenCV, but the pack's requirements.txt doesn't install it. The README mentions opencv-python, the requirements file doesn't include it, so on a clean install this node throws No module named 'cv2'. Fix it with:
pip install opencv-python
Then the second trap - the width/height defaults of 0. If you leave them, the foreground gets resized to 0×0 and you get a resize error. Set them explicitly, even if you intend "same size as the crop." Finally, remember it's NORMAL_CLONE on the first frame of each batch: multi-frame batches only blend frame zero, so for video you'd blend frames individually. Get those three things right and it's a genuinely nice compositing tool.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| background | IMAGE | 背景图像 (N,H,W,C) | |
| foreground | IMAGE | 前景图像 (N,H,W,C) | |
| mask | IMAGE | 掩码图像 (N,H,W,C),单通道或三通道 | |
| x | INT | 0 | 融合左上角X坐标 |
| y | INT | 0 | 融合左上角Y坐标 |
| width | INT | 0 | 融合宽度 |
| height | INT | 0 | 融合高度 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| blended | IMAGE | — |