# psd_tools.api.mask

Mask module.

## Mask

class psd_tools.api.mask.Mask(layer: Any)

  Mask data attached to a layer.

  There are two distinct internal mask data: user mask and vector mask. User mask refers any pixel-based mask whereas vector mask refers a mask from a shape path. Internally, two masks are combined and referred real mask.

  property background_color: int

    Background color.

  property bbox: tuple[int, int, int, int]

    BBox

  property bottom: int

    Bottom coordinate.

  property disabled: bool

    Disabled.

  property flags: MaskFlags

    Flags.

  property height: int

    Height.

  property left: int

    Left coordinate.

  property parameters

    Parameters.

  property real_flags: MaskFlags | None

    Real flag.

  property right: int

    Right coordinate.

  property size: tuple[int, int]

    (Width, Height) tuple.

  property top: int

    Top coordinate.

  topil(real: bool = True, **kwargs: Any) → Image | None

    Get PIL Image of the mask.

    Parameters:

      real – When True, returns pixel + vector mask combined.

    Returns:

      PIL Image object, or None if the mask is empty.

  property width: int

    Width.