Class ResizeExtensions
Defines extensions that allow the application of resize operations on an Image using Mutate/Clone.
Inherited Members
Namespace: SixLabors.ImageSharp.Processing
Assembly: SixLabors.ImageSharp.dll
Syntax
public static class ResizeExtensions
Methods
| Edit this page View SourceResize(IImageProcessingContext, ResizeOptions)
Resizes an image in accordance with the given ResizeOptions.
Declaration
public static IImageProcessingContext Resize(this IImageProcessingContext source, ResizeOptions options)
Parameters
Type | Name | Description |
---|---|---|
IImageProcessingContext | source | The current image processing context. |
ResizeOptions | options | The resize options. |
Returns
Type | Description |
---|---|
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.
Declaration
public static IImageProcessingContext Resize(this IImageProcessingContext source, Size size)
Parameters
Type | Name | Description |
---|---|---|
IImageProcessingContext | source | The current image processing context. |
Size | size | The target image size. |
Returns
Type | Description |
---|---|
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.
Declaration
public static IImageProcessingContext Resize(this IImageProcessingContext source, Size size, IResampler sampler, bool compand)
Parameters
Type | Name | Description |
---|---|---|
IImageProcessingContext | source | The current image processing context. |
Size | size | The target image size. |
IResampler | sampler | The IResampler to perform the resampling. |
bool | compand | Whether to compress and expand the image color-space to gamma correct the image during processing. |
Returns
Type | Description |
---|---|
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.
Declaration
public static IImageProcessingContext Resize(this IImageProcessingContext source, Size size, bool compand)
Parameters
Type | Name | Description |
---|---|---|
IImageProcessingContext | source | The current image processing context. |
Size | size | The target image size. |
bool | compand | Whether to compress and expand the image color-space to gamma correct the image during processing. |
Returns
Type | Description |
---|---|
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.
Declaration
public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
IImageProcessingContext | source | The current image processing context. |
int | width | The target image width. |
int | height | The target image height. |
Returns
Type | Description |
---|---|
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.
Declaration
public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, IResampler sampler)
Parameters
Type | Name | Description |
---|---|---|
IImageProcessingContext | source | The current image processing context. |
int | width | The target image width. |
int | height | The target image height. |
IResampler | sampler | The IResampler to perform the resampling. |
Returns
Type | Description |
---|---|
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.
Declaration
public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, IResampler sampler, Rectangle sourceRectangle, Rectangle targetRectangle, bool compand)
Parameters
Type | Name | Description |
---|---|---|
IImageProcessingContext | source | The current image processing context. |
int | width | The target image width. |
int | height | The target image height. |
IResampler | sampler | The IResampler to perform the resampling. |
Rectangle | sourceRectangle | The Rectangle structure that specifies the portion of the image object to draw. |
Rectangle | targetRectangle | The Rectangle structure that specifies the portion of the target image object to draw to. |
bool | compand | Whether to compress and expand the image color-space to gamma correct the image during processing. |
Returns
Type | Description |
---|---|
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.
Declaration
public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, IResampler sampler, Rectangle targetRectangle, bool compand)
Parameters
Type | Name | Description |
---|---|---|
IImageProcessingContext | source | The current image processing context. |
int | width | The target image width. |
int | height | The target image height. |
IResampler | sampler | The IResampler to perform the resampling. |
Rectangle | targetRectangle | The Rectangle structure that specifies the portion of the target image object to draw to. |
bool | compand | Whether to compress and expand the image color-space to gamma correct the image during processing. |
Returns
Type | Description |
---|---|
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.
Declaration
public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, IResampler sampler, bool compand)
Parameters
Type | Name | Description |
---|---|---|
IImageProcessingContext | source | The current image processing context. |
int | width | The target image width. |
int | height | The target image height. |
IResampler | sampler | The IResampler to perform the resampling. |
bool | compand | Whether to compress and expand the image color-space to gamma correct the image during processing. |
Returns
Type | Description |
---|---|
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.
Declaration
public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, bool compand)
Parameters
Type | Name | Description |
---|---|---|
IImageProcessingContext | source | The current image processing context. |
int | width | The target image width. |
int | height | The target image height. |
bool | compand | Whether to compress and expand the image color-space to gamma correct the image during processing. |
Returns
Type | Description |
---|---|
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.