Image Blend by Mask
Composite two images using a mask as the seam
This is the compositing workhorse: take two images and a mask, and the mask decides which image shows where. White areas of the mask reveal one image, black areas reveal the other, and grey gives you a soft blend between them. Image Blend by Mask is how you paste a cut-out subject onto a new background, drop an edited region back into an original, or mix two renders along a controlled seam.
If you've done any background-removal or inpainting work, this is the node that puts the pieces back together. Segment the subject, then blend it over a fresh scene using that subject mask.
How it works
Per pixel, the mask value picks between the two source images. Where the mask is fully white, you see image A; where it's fully black, you see image B; the grey in between is a weighted mix, which is why a soft or feathered mask gives you a gradual edge instead of a hard cut-out line. There's also an overall blend amount so you can dial the whole composite's strength rather than relying purely on the mask's own values.
Because it's a straight per-pixel operation, the three inputs should share the same dimensions. Mismatched sizes are the number-one cause of "why is my composite offset/garbled."
Inputs and outputs that matter
The three that matter:
- two IMAGE inputs - the two things you're mixing (subject and background, original and edit).
- a MASK - the boss. Its white/black/grey values drive the blend. Feather it for soft seams.
Plus an overall blend strength to scale the effect. The output is a single blended IMAGE, ready to save or push into an upscale.
The mask quality is everything here. A crisp binary mask gives you a hard edge that can look pasted-on; a slightly feathered or matting-style mask gives you edges that sit naturally. The background-removal KB makes the point that for genuinely semi-transparent edges - hair, glass - a segmentation mask fundamentally can't represent partial coverage, which is why hard cut-outs blended this way sometimes look wrong at the hairline. If the mask can't describe a half-transparent pixel, no blend node can invent it.
How to install it
ComfyUI Manager: search was-node-suite-comfyui, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui
then install the pack's requirements.txt in your ComfyUI venv and restart. No model downloads - it's image math.
Common issues & troubleshooting
The two images show up in the wrong places. Your mask polarity is backwards. Mask is white-is-A; if your subject and background are swapped, invert the mask (Mask Invert in this pack) or flip which image goes into which input.
The seam is a hard, obvious line. Your mask is a crisp binary. Feather it - a gaussian blur on the mask, or use a matting-quality mask to begin with - so the transition has some grey to blend through. Hard masks make composites look pasted.
The composite is offset or partly cut off. Sizes don't match. Resize both images and the mask to identical dimensions before blending.
Hairline/edge halos. This is the limit of segmentation masks, not the node. A hard fore/background mask can't represent the semi-transparent fringe of hair, so you get either a halo of old background or a chewed edge. If edges matter, reach for a matting model upstream (the background-removal KB covers BiRefNet matting weights) rather than expecting the blend to fix it.
Whole pack won't import after a ComfyUI update. The familiar WAS Node Suite issue - package downgrades colliding with a ComfyUI bump. Re-run the pack's requirements against the activated venv, or install.bat. Maintenance-only since late 2023.
Inputs (0)
No inputs
Outputs (0)
No outputs