ResizeMode Enum

Controls how the target size of a resize is interpreted.

public enum ResizeMode

Fields

NameValueDescription
Contain0Preserves the aspect ratio and fits the whole image within the target size, without padding: one dimension equals the target and the other is smaller or equal. This is the default.
Stretch1Produces exactly the target size, ignoring the aspect ratio.
Cover2Preserves the aspect ratio, covers the target size, and crops the overflow according to ResizeOptions.Anchor, producing exactly the target size.
Pad3Fits the whole image within the target size as ResizeMode.Contain does, then pads it to exactly the target size with ResizeOptions.BackgroundColor; the image is placed on the canvas according to ResizeOptions.Anchor (letterboxing).
BoxPad4Pads the image to exactly the target size like ResizeMode.Pad, but never enlarges it: an image that already fits keeps its size and is only placed on the canvas, and a larger one is reduced as by ResizeMode.Pad. It is ResizeMode.Pad with ResizeOptions.AllowUpscaling set to false.