ComfyUI Node

Mask Blend

Blend two masks with add / subtract / intersect / exclude, or keep one half by direction, then optionally replace the non-zero bounding box with a solid rectangle according to the BBOX rule and report that rectangle's width and height. Sizes are matched automatically and a batch uses the combined extent of every frame.

By live1617·Created about a month ago·Updated a day ago· 4
Mask Blend
  • mask1
  • mask2
  • mask
  • width
  • height
◄blend_modesubtract►
◄bboxoff►
◄aligncenter►
CategoryQG-tools/Mask

Inputs (5)

NameTypeDefaultDescription
blend_modeCOMBOsubtractadd / subtract / intersect / exclude work per pixel (exclude is NOR: the area neither mask covers). left / right / top / bottom compare the two masks' non-zero extents, cut at the nearer edge and keep that half of mask 1 only.
bboxCOMBOoffReplace the non-zero bounding box of the blended mask with a solid white rectangle (not a crop). off outputs the blended mask as it is and still reports the box size. The other rules rescale the box 1:1; align decides where it lands.
alignCOMBOcenterWhere the new rectangle sits relative to the original bounding box. Has no effect when bbox is off or original.
mask1optMASKFirst mask. Its canvas size is the reference; the other mask is resized to match when the sizes differ.
mask2optMASKSecond mask. Leave it unconnected to use an all-black mask of the same size.

Outputs (3)

NameTypeDescription
maskMASK—
widthINT—
heightINT—