Studio Yotsuba
Back to Node List

Path Mask

path_mask

Convert closed bezier paths into a white alpha mask

Reviewed
Guide available

Input Ports

NameTypeDescription
Path
path
Path
Required
Bezier path to convert into a mask

Output Ports

NameTypeDescription
Image
output
Image
White alpha mask image generated from the path

Parameters

NameTypeDefaultRangeDescription / Options
Width
width
Int
641–1024

Canvas width in pixels

Height
height
Int
641–1024

Canvas height in pixels

Overlap Mode
fill_rule
Enum
Union—

How overlapping closed paths are combined into filled areas

  • UnionUnion
    Fill whenever a pixel is inside any closed path
  • EvenOddEvenOdd
    Filled and empty areas alternate each time paths overlap
  • NonZeroNonZero
    Use the drawing direction of each path to decide filled and hole areas
Pixel Perfect
pixel_perfect
Bool
false—

Build the mask from pixel-perfect path outlines

PP Mode
pp_mode
Enum
RemoveCorner—

Which redundant pixels to remove in pixel-perfect mode

  • DiagonalDiagonal
    Remove horizontal steps for more diagonal lines
  • CardinalCardinal
    Remove vertical steps for more horizontal/vertical lines
  • RemoveCornerRemoveCorner
    Prefer removing the L-corner pixel
  • KeepCornerKeepCorner
    Prefer keeping the L-corner pixel
Closed Path Cross
pp_closed_cross
Bool
false—

Use cross-product based inner/outer edge removal for closed subpaths

Closed Edge
pp_closed_side
Enum
Outer—

Which side of closed path edges to remove

  • InnerInner
    Remove inner edge pixels
  • OuterOuter
    Remove outer edge pixels

Overview

Converts closed paths into a white + alpha mask image. It turns a free-form shape drawn in a path editor into something usable for a cutout (mask) or a scatter area (mask_scatter). It bridges "draw the shape as a path" and "determine its use as a mask."

Usage tips

  • The go-to flow is multi_path_editor → path_mask → mask (clip an image), or → mask_scatter (scatter within the area).
  • For a shape with a hole, use fill_rule = EvenOdd: draw an outer and inner boundary to create a doughnut or frame mask.
  • Enable pixel_perfect when the line from path_stroke and the silhouette must match exactly.
  • Standard PP cleanup uses pp_mode. For a closed path with pp_closed_cross enabled, pp_closed_side is used instead.
  • Use path_fill when you need a colored fill image instead of white.

Related nodes

  • mask / mask_boolean — use or further combine the mask
  • mask_scatter — use it as an area
  • path_fill — when you need a colored fill
  • path_reverse — control holes under NonZero

Fill rules

Mode Description
Union / Fill all Fills a point if it is inside any closed path. This is the basic mode for simply overlapping shapes.
EvenOdd / Cut out the inside Alternates fill and cutout on every overlap. Suited to hollow centers such as doughnuts or frames.
NonZero / Determine holes by direction Uses path direction to determine whether an area is filled or cut out. An advanced mode for drawing outer boundaries and holes explicitly.

Pixel perfect

  • Off: builds the mask from the normal outline.
  • On: builds the mask from the same PP-corrected outline as Path Stroke.

Enable it when the appearance of Path Stroke must match the filled silhouette.

Algorithm

  1. For closed subpaths only, obtain the outline pixel sequence with rasterize_subpath.
  2. Treat all subpaths as one face and test the center of every pixel with fill_rule to determine inside/outside.
  3. Draw white (1,1,1,1) in the fill area and outline, leaving everything else transparent.

Examples

Create a mask from a path

[Multi Path] → path → [Path Mask(fill_rule:Union)] → [Preview]

Clip an image to a path shape

[Pixel Canvas] → source → [Mask] → [Preview]
                         ↑
               [Path Mask] → mask

Define an area for surface scattering

[Multi Path] → [Path Mask] → [Mask Scatter]

Notes

  • Open subpaths are ignored.
  • If there is no closed subpath, or no Path is connected, the result is transparent.
  • Unlike PathFill, this treats multiple subpaths together as one face.
  • The output is a white + alpha image intended for use with the Mask node.
  • Use Union / Fill all when overlapping areas should remain filled.
Back to Node List