Resize by the given dimensions, using a specified method of resizing: fill, crop, pad, etc.

width : Integer

The width in pixels.

height : Integer

The height in pixels.

method : ResizeMethod
  • BestFit: Resize by enlarging or reducing - just enough to best fit the given size while preserving the aspect ratio.
  • IgnoreAspectRatio: This option forces the ratio to be ignored so the given size is matched exactly.
  • Fill: Resize based on the smallest fitting dimension. The resized image will completely fill (and even overflow) the given size.
  • Pad: Resize to fit within the given size and then add a border around the image to exactly match the given size.
  • Crop: Crop (cut out parts of the image) to exactly match the given size.