Nodes/ComfyUI-UtilsCollection/Image Blend by Mask
ComfyUI Node

Image Blend by Mask

Blend two images with an actual mask

By silveroxides·Created 2 months ago·Updated about 7 hours ago· 24
Image Blend by Mask
  • destination
  • source
  • mask
  • blended_image
modeadd
blend_percentage1.00
resize_sourcefalse

Compositing has a boring-but-essential step between "put image A over image B" and "it looks real": blending the two so the boundary isn't a hard cut. UC_ImageBlendByMask does that with a mask plus your choice of blend mode - and unlike a one-mode paste, the mask is resized and broadcast for you, which removes an entire class of "these dims don't match" errors.

The shape is classic: a destination (the base you keep) and a source (what you blend in), with a mask deciding where the source shows through. Where the mask is zero, you get the destination; where it's one, you get the blend; in between, a mix. blend_percentage (default 1.0) scales the whole thing down when you want a partial effect.

Blend modes

mode defaults to add, and it's a real Photoshop-style list: add, color, color_burn, color_dodge, darken, difference, exclusion, hard_light, hue, lighten, multiply, overlay, screen, soft_light. A quick map for the ones you'll actually use: screen lightens and is great for glows or light leaks; multiply darkens and is the standard for texturing/shadows; overlay and soft_light punch up contrast; difference is a debugging/inversion tool; color transfers the source's hue without its luminance. Everything clamps to 0–1, so runaway add won't blow out to white garbage.

The inputs that matter

  • destination / source - the two images. If resize_source is off (default), dimensions and batch size must match, or you get a clear error.
  • resize_source - turn it on to have the source bicubic-resized to the destination's size instead.
  • mask - optional; resized to destination dimensions and singleton batches broadcast across the image batch, which is the "connect one mask to a batch of frames" convenience.

Single output: blended_image.

Installing it

ComfyUI Manager → search "ComfyUI-UtilsCollection", or:

cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection

Restart. Pack deps are opencv-python and typing-extensions, no model downloads. Newer-API pack - keep ComfyUI reasonably updated.

Where it bites: forgetting resize_source and connecting mismatched sizes gets you an error (fine, at least it's explicit), but connecting a mostly matching pair with the mode set to add can silently over-brighten - check blend_percentage before blaming the mask. And for hard-edged masks, the pack's ModifyMask/blur route is your friend; this node blends colors, it won't soften a jagged mask for you.

Categoryutils/mask

Inputs (6)

NameTypeDefaultDescription
destinationIMAGEBase image retained where the mask or blend strength is zero.
sourceIMAGEImage combined with the destination using the selected blend mode.
modeCOMBOaddColor blend operation applied between the source and destination images.
blend_percentageFLOAT1.000–1Overall blend strength multiplied by the optional mask.
resize_sourceBOOLEANfalseResizes the source to destination dimensions with bicubic interpolation; otherwise dimensions must match.
maskMASKControls where the blend is applied; it is resized and singleton batches broadcast to the image batch.

Outputs (1)

NameTypeDescription
blended_imageIMAGE