FileHelper.Resize Method

Namespace:
Weavy.Core.Helpers
Assembly:
Weavy.Core.dll

Resize(FileInfo, int?, int?, FitMode, ScaleMode, ContentAlignment, Color?, int, int, bool, string)

Returns a resized version of the specified image.

public static FileInfo Resize(FileInfo image, int? width, int? height, FitMode fit = FitMode.Fit, ScaleMode scale = ScaleMode.Down, ContentAlignment align, Color? background = default(Color? ), int quality = 90, int opacity = 100, bool ignoreICC = false, string extension = null)

Parameters

image
System.IO.FileInfo

The image to resize.

width
int?

The width constraint.

height
int?

The height constraint.

fit
FitMode

The constraint mode, determines how to resolve aspect ratio differences between the requested size and the original image's size.

scale
ScaleMode

Controls whether the image is allowed to upscale, downscale, both, or if only the canvas gets to be upscaled.

align
System.Drawing.ContentAlignment

How to align the image when padding or cropping.

background
System.Drawing.Color?

The background color to apply (null for transparency), white will be used for jpg images when background is unspecified.

quality
int

The encoding quality to use, only applies to jpg images.

opacity
int
ignoreICC
bool

If true, the ICC profile of the image will be ignored.

extension
string

File extension of desired output format.

Returns

System.IO.FileInfo

Returns a System.IO.FileInfo object pointing to the resized image, or null if the image could not be resized.