Table of Contents

Class ResizeExtensions

Namespace
SixLabors.ImageSharp.Processing
Assembly
SixLabors.ImageSharp.dll

Defines extensions that allow the application of resize operations on an Image using Mutate/Clone.

public static class ResizeExtensions
Inheritance
ResizeExtensions
Inherited Members

Methods

Resize(IImageProcessingContext, ResizeOptions)

Resizes an image in accordance with the given ResizeOptions.

public static IImageProcessingContext Resize(this IImageProcessingContext source, ResizeOptions options)

Parameters

source IImageProcessingContext

The current image processing context.

options ResizeOptions

The resize options.

Returns

IImageProcessingContext

The IImageProcessingContext.

Remarks

Passing zero for one of height or width within the resize options will automatically preserve the aspect ratio of the original image or the nearest possible ratio.

Resize(IImageProcessingContext, Size)

Resizes an image to the given Size.

public static IImageProcessingContext Resize(this IImageProcessingContext source, Size size)

Parameters

source IImageProcessingContext

The current image processing context.

size Size

The target image size.

Returns

IImageProcessingContext

The IImageProcessingContext.

Remarks

Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.

Resize(IImageProcessingContext, Size, IResampler, bool)

Resizes an image to the given width and height with the given sampler.

public static IImageProcessingContext Resize(this IImageProcessingContext source, Size size, IResampler sampler, bool compand)

Parameters

source IImageProcessingContext

The current image processing context.

size Size

The target image size.

sampler IResampler

The IResampler to perform the resampling.

compand bool

Whether to compress and expand the image color-space to gamma correct the image during processing.

Returns

IImageProcessingContext

The IImageProcessingContext.

Remarks

Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.

Resize(IImageProcessingContext, Size, bool)

Resizes an image to the given Size.

public static IImageProcessingContext Resize(this IImageProcessingContext source, Size size, bool compand)

Parameters

source IImageProcessingContext

The current image processing context.

size Size

The target image size.

compand bool

Whether to compress and expand the image color-space to gamma correct the image during processing.

Returns

IImageProcessingContext

The IImageProcessingContext.

Remarks

Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.

Resize(IImageProcessingContext, int, int)

Resizes an image to the given width and height.

public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height)

Parameters

source IImageProcessingContext

The current image processing context.

width int

The target image width.

height int

The target image height.

Returns

IImageProcessingContext

The IImageProcessingContext.

Remarks

Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.

Resize(IImageProcessingContext, int, int, IResampler)

Resizes an image to the given width and height with the given sampler.

public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, IResampler sampler)

Parameters

source IImageProcessingContext

The current image processing context.

width int

The target image width.

height int

The target image height.

sampler IResampler

The IResampler to perform the resampling.

Returns

IImageProcessingContext

The IImageProcessingContext.

Remarks

Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.

Resize(IImageProcessingContext, int, int, IResampler, Rectangle, Rectangle, bool)

Resizes an image to the given width and height with the given sampler and source rectangle.

public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, IResampler sampler, Rectangle sourceRectangle, Rectangle targetRectangle, bool compand)

Parameters

source IImageProcessingContext

The current image processing context.

width int

The target image width.

height int

The target image height.

sampler IResampler

The IResampler to perform the resampling.

sourceRectangle Rectangle

The Rectangle structure that specifies the portion of the image object to draw.

targetRectangle Rectangle

The Rectangle structure that specifies the portion of the target image object to draw to.

compand bool

Whether to compress and expand the image color-space to gamma correct the image during processing.

Returns

IImageProcessingContext

The IImageProcessingContext.

Remarks

Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.

Resize(IImageProcessingContext, int, int, IResampler, Rectangle, bool)

Resizes an image to the given width and height with the given sampler and source rectangle.

public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, IResampler sampler, Rectangle targetRectangle, bool compand)

Parameters

source IImageProcessingContext

The current image processing context.

width int

The target image width.

height int

The target image height.

sampler IResampler

The IResampler to perform the resampling.

targetRectangle Rectangle

The Rectangle structure that specifies the portion of the target image object to draw to.

compand bool

Whether to compress and expand the image color-space to gamma correct the image during processing.

Returns

IImageProcessingContext

The IImageProcessingContext.

Remarks

Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.

Resize(IImageProcessingContext, int, int, IResampler, bool)

Resizes an image to the given width and height with the given sampler.

public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, IResampler sampler, bool compand)

Parameters

source IImageProcessingContext

The current image processing context.

width int

The target image width.

height int

The target image height.

sampler IResampler

The IResampler to perform the resampling.

compand bool

Whether to compress and expand the image color-space to gamma correct the image during processing.

Returns

IImageProcessingContext

The IImageProcessingContext.

Remarks

Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.

Resize(IImageProcessingContext, int, int, bool)

Resizes an image to the given width and height.

public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, bool compand)

Parameters

source IImageProcessingContext

The current image processing context.

width int

The target image width.

height int

The target image height.

compand bool

Whether to compress and expand the image color-space to gamma correct the image during processing.

Returns

IImageProcessingContext

The IImageProcessingContext.

Remarks

Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.