Browse Source

Add size overload to Resize

af/merge-core
James Jackson-South 9 years ago
parent
commit
88d379fb0a
  1. 14
      src/ImageSharp.Processing/Transforms/Resize.cs

14
src/ImageSharp.Processing/Transforms/Resize.cs

@ -42,6 +42,20 @@ namespace ImageSharp
return Resize(source, options.Size.Width, options.Size.Height, options.Sampler, source.Bounds, targetRectangle, options.Compand);
}
/// <summary>
/// Resizes an image to the given <see cref="Size"/>.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <param name="source">The image to resize.</param>
/// <param name="size">The target image size.</param>
/// <returns>The <see cref="Image{TColor}"/></returns>
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks>
public static Image<TColor> Resize<TColor>(this Image<TColor> source, Size size)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return Resize(source, size.Width, size.Height, new BicubicResampler(), false);
}
/// <summary>
/// Resizes an image to the given width and height.
/// </summary>

Loading…
Cancel
Save