From 70c98c5b80fd34e3f45c2660f349ef9df9a30c60 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 5 Jan 2017 11:23:36 +1100 Subject: [PATCH] Add size overload to Resize --- src/ImageSharp.Processing/Transforms/Resize.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ImageSharp.Processing/Transforms/Resize.cs b/src/ImageSharp.Processing/Transforms/Resize.cs index 02a03d79be..35ffc8b7dd 100644 --- a/src/ImageSharp.Processing/Transforms/Resize.cs +++ b/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); } + /// + /// Resizes an image to the given . + /// + /// The pixel format. + /// The image to resize. + /// The target image size. + /// The + /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image + public static Image Resize(this Image source, Size size) + where TColor : struct, IPackedPixel, IEquatable + { + return Resize(source, size.Width, size.Height, new BicubicResampler(), false); + } + /// /// Resizes an image to the given width and height. ///