pad#

rlemasklib.RLEMask.pad(top, bottom, left, right, border_type='constant', value=0, inplace=False)[source]#

Pad the mask with constant values.

Parameters:
  • top – the number of pixels to pad on the top

  • bottom – the number of pixels to pad on the bottom

  • left – the number of pixels to pad on the left

  • right – the number of pixels to pad on the right

  • border_type – either ‘constant’, ‘replicate’, or ‘edge’

  • value (int) – the value to pad with (0 or 1), only used when border_type=’constant’

  • inplace – whether to perform the operation in place or to return a new object

Returns:

An RLEMask object representing the padded mask.

Return type:

RLEMask

Examples

Pad with 1 pixel of background on all sides:

.pad(1, 1, 1, 1) ==

See also

crop(), shift()