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.

background_color

Background color.

bbox

BBox

bottom

Bottom coordinate.

disabled

Disabled.

flags

Flags.

height

Height.

left

Left coordinate.

parameters

Parameters.

real_flags

Real flag.

right

Right coordinate.

size

(Width, Height) tuple.

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.
width

Width.