Back to Node List

Mask Boolean

mask_boolean

Combines two mask images with boolean-style operations

Reviewed
Guide available
The node name and summary are available in English. Port, parameter, and article details are currently shown in Japanese.

Input Ports

NameTypeDescription
A
a
Image
Required
土台にするマスクです
B
b
Image
Required
重ねたり引いたりする側のマスクです

Output Ports

NameTypeDescription
画像
output
Image
合成した後のマスク画像です

Parameters

NameTypeDefaultRangeDescription / Options
合成方法
op
Enum
Union

どうやって2つのマスクをまとめるか選びます

  • 合体Union
    A または B のどちらかにある所を残します
  • 引き算Subtract
    A から B の領域を削ります
  • 重なりだけIntersect
    重なった部分だけ残します
マスクの読み方
source
Enum
Auto

白黒マスクと透明度マスクをどの成分で読むか選びます。通常は自動で構いません。

  • 自動Auto
    透明度にマスク情報があればアルファを使い、全面不透明なら輝度を使います。
  • アルファAlpha
    両方の入力をアルファチャンネルで判定します。
  • 輝度Luminance
    両方の入力をRec.709輝度で判定します。

What is it for?

  • When you want to combine two shapes into one mask
  • When you want to remove an area to make a hole
  • When you want to extract only the overlapping area

Overview

Combines two masks with Boolean operations that add them, subtract one from the other, or retain only their intersection. It is a core mask-work component for building complex selections from simple shape masks.

Usage tips

  • Think of it as the 2D-mask counterpart to the Solid nodes solid_combine / solid_subtract / solid_intersect.
  • Cutting a window with Subtract is a common pattern: subtract a circle from a rectangle to make a frame, or subtract a face mask from a full-character mask to create "everything except the face."
  • Clean up small chips or specks after combining with pixel_cleanup or morphology.
  • It supports both binary masks and gray or translucent values as continuous soft masks. Use blend or expression_pixel for value images with another meaning, such as progress maps.

Related nodes

  • path_mask / shape_generate — generate source masks
  • mask — cut out an image with the completed mask
  • morphology / pixel_cleanup — shape and clean up the combined result
  • blend — combine value images

Operations

  • Union
    • Retains areas present in either A or B.
    • Use it to combine two shapes.
  • Subtract
    • Removes the area of B from A.
    • Useful for making shapes with holes.
  • Intersect
    • Retains only areas where A and B overlap.
    • Use it to extract only the common area.

Notes

  • The output is a white + alpha mask image. RGB is always white.
  • The output dimensions match the larger of A and B.
  • source selects the channel. Alpha reads alpha, Luminance reads luminance, and Auto reads alpha for any image containing at least one translucent pixel but reads luminance for a fully opaque image.
  • For soft masks, Union=max(A,B), Intersect=min(A,B), and Subtract=A*(1-B), preserving continuous values.
  • An antialiased black-and-white image can switch Auto to alpha, making opaque black pixels value 1. Choose Alpha or Luminance explicitly when the intent must be stable.
  • This is not suited to combining "value images" such as progress maps, normal maps, or depth maps. Treat those as maps rather than masks.

Examples

  1. Apply Union to Rectangle Mask and Circle Mask
    • Creates a mask combining the two shapes.
  2. Subtract Circle Mask from Rectangle Mask
    • Creates a cutout like a window or hole.
  3. Apply Intersect to two flow masks
    • Use this when you want to process only their overlap separately.
Back to Node List
Mask Boolean — PixPipeline Node Reference