diff --git a/src/ImageProcessor/ImageExtensions.cs b/src/ImageProcessor/ImageExtensions.cs index bfdd7ace9..d66d80eb7 100644 --- a/src/ImageProcessor/ImageExtensions.cs +++ b/src/ImageProcessor/ImageExtensions.cs @@ -85,7 +85,7 @@ namespace ImageProcessor /// /// The source image. Cannot be null. /// The target image width. - /// The target image width. + /// The target image height. /// Any processors to apply to the image. /// The . public static Image Process(this Image source, int width, int height, params IImageProcessor[] processors) @@ -98,7 +98,7 @@ namespace ImageProcessor /// /// The source image. Cannot be null. /// The target image width. - /// The target image width. + /// The target image height. /// /// The structure that specifies the portion of the image object to draw. /// diff --git a/src/ImageProcessor/Samplers/ImageSampleExtensions.cs b/src/ImageProcessor/Samplers/ImageSampleExtensions.cs index d6600eac4..ddd702c4a 100644 --- a/src/ImageProcessor/Samplers/ImageSampleExtensions.cs +++ b/src/ImageProcessor/Samplers/ImageSampleExtensions.cs @@ -1,4 +1,4 @@ -// +// // Copyright © James South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -6,20 +6,50 @@ namespace ImageProcessor.Samplers { /// - /// Exstensions methods for to apply samplers to the image. + /// Extensions methods for to apply samplers to the image. /// public static class ImageSampleExtensions { + /// + /// Resizes an image to the given width and height. + /// + /// The image to resize. + /// The target image width. + /// The target image height. + /// The public static Image Resize(this Image source, int width, int height) { return source.Process(width, height, default(Rectangle), default(Rectangle), new Resize(new BicubicResampler())); } + /// + /// Resizes an image to the given width and height with the given sampler. + /// + /// The image to resize. + /// The target image width. + /// The target image height. + /// The to perform the resampling. + /// The public static Image Resize(this Image source, int width, int height, IResampler sampler) { return source.Process(width, height, default(Rectangle), default(Rectangle), new Resize(sampler)); } + /// + /// Resizes an image to the given width and height with the given sampler. + /// + /// The image to resize. + /// The target image width. + /// The target image height. + /// The to perform the resampling. + /// + /// The structure that specifies the portion of the image object to draw. + /// + /// + /// The structure that specifies the location and size of the drawn image. + /// The image is scaled to fit the rectangle. + /// + /// The public static Image Resize(this Image source, int width, int height, IResampler sampler, Rectangle sourceRectangle, Rectangle targetRectangle) { return source.Process(width, height, sourceRectangle, targetRectangle, new Resize(sampler)); diff --git a/tests/ImageProcessor.Tests/Processors/ProcessorTestBase.cs b/tests/ImageProcessor.Tests/Processors/ProcessorTestBase.cs index d8399d73f..252425edf 100644 --- a/tests/ImageProcessor.Tests/Processors/ProcessorTestBase.cs +++ b/tests/ImageProcessor.Tests/Processors/ProcessorTestBase.cs @@ -19,10 +19,11 @@ namespace ImageProcessor.Tests /// public static readonly List Files = new List { - "../../TestImages/Formats/Jpg/Backdrop.jpg", - "../../TestImages/Formats/Bmp/Car.bmp", - "../../TestImages/Formats/Png/cmyk.png", - "../../TestImages/Formats/Gif/leaf.gif" + //"../../TestImages/Formats/Jpg/Backdrop.jpg", + "../../TestImages/Formats/Jpg/Calliphora.jpg", + //"../../TestImages/Formats/Bmp/Car.bmp", + //"../../TestImages/Formats/Png/cmyk.png", + //"../../TestImages/Formats/Gif/leaf.gif" // { "../../TestImages/Formats/Gif/ani.gif" }, // { "../../TestImages/Formats/Gif/ani2.gif" }, diff --git a/tests/ImageProcessor.Tests/Processors/Samplers/SamplerTests.cs b/tests/ImageProcessor.Tests/Processors/Samplers/SamplerTests.cs index 7a9e0f732..0cb6117b3 100644 --- a/tests/ImageProcessor.Tests/Processors/Samplers/SamplerTests.cs +++ b/tests/ImageProcessor.Tests/Processors/Samplers/SamplerTests.cs @@ -44,7 +44,7 @@ namespace ImageProcessor.Tests string filename = Path.GetFileNameWithoutExtension(file) + "-" + name + Path.GetExtension(file); using (FileStream output = File.OpenWrite($"Resized/{filename}")) { - image.Resize(500, 500, sampler).Save(output); + image.Resize(200, 298, sampler).Save(output); } Trace.WriteLine($"{name}: {watch.ElapsedMilliseconds}ms"); diff --git a/tests/ImageProcessor.Tests/TestImages/Formats/Jpg/Calliphora.jpg.REMOVED.git-id b/tests/ImageProcessor.Tests/TestImages/Formats/Jpg/Calliphora.jpg.REMOVED.git-id new file mode 100644 index 000000000..44bed7ad3 --- /dev/null +++ b/tests/ImageProcessor.Tests/TestImages/Formats/Jpg/Calliphora.jpg.REMOVED.git-id @@ -0,0 +1 @@ +5d446f64d0636f6ad7e9f82625eeff89ef394fe2 \ No newline at end of file