psd_tools.api.mask

Mask module.

Mask

class psd_tools.api.mask.Mask(layer)[source]

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

Background color.

property bbox

BBox

property bottom

Bottom coordinate.

property disabled

Disabled.

property flags

Flags.

property height

Height.

property left

Left coordinate.

property parameters

Parameters.

property real_flags

Real flag.

property right

Right coordinate.

property size

(Width, Height) tuple.

property top

Top coordinate.

topil(real=True, **kwargs)[source]

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

Width.