pierogis.ingredients.resize module

class pierogis.ingredients.resize.Resize(opacity: int = 100, mask: Optional[numpy.ndarray] = None, **kwargs)[source]

Bases: pierogis.ingredients.ingredient.Ingredient

resize using width, height, and scale

FILTERS = {'bicubic': 3, 'bilinear': 2, 'box': 4, 'default': 0, 'hamming': 5, 'lanczos': 1, 'nearest': 0}
cook(pixels: numpy.ndarray)[source]

performs actions on a pixel array and returns a cooked array

prep(width: Optional[int] = None, height: Optional[int] = None, scale: int = 1, resample: Union[int, str] = 0, **kwargs)[source]

if only one of width and height is provided, aspect ratio will be maintained.

when reducing size, a dimension will round down if it would be a decimal

cook 5x5 pixels prepped with a .5 scale -> resized to 2x2 cook 2x3 pixels prepped with a width of 1 -> resized to 1x1

  • width – width to resize to

  • height – height to resize to

  • scale – scale multiplier (2 means 2x)

  • resample – resample filter to use