Studio Yotsuba
Back to Node List

Mask Boolean

mask_boolean

Combines two mask images with boolean-style operations

Reviewed
Guide available

Input Ports

NameTypeDescription
A
a
Image
Required
Primary mask
B
b
Image
Required
Secondary mask

Output Ports

NameTypeDescription
Image
output
Image
Combined white alpha mask

Parameters

NameTypeDefaultRangeDescription / Options
Operation
op
Enum
Union—

Boolean-style combination mode

  • UnionUnion
    Keep pixels from either mask
  • SubtractSubtract
    Remove mask B from mask A
  • IntersectIntersect
    Keep only overlapping pixels
Mask Source
source
Enum
Auto—

Choose how white/black and transparent masks are interpreted.

  • AutoAuto
    Use alpha when transparency carries mask information; otherwise use luminance.
  • AlphaAlpha
    Use the alpha channel of both inputs.
  • LuminanceLuminance
    Use Rec.709 luminance of both inputs.

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