diff --git a/src/ImageProcessor/Samplers/ImageSampleExtensions.cs b/src/ImageProcessor/Samplers/ImageSampleExtensions.cs
index 60ee86103..d6600eac4 100644
--- a/src/ImageProcessor/Samplers/ImageSampleExtensions.cs
+++ b/src/ImageProcessor/Samplers/ImageSampleExtensions.cs
@@ -12,17 +12,17 @@ namespace ImageProcessor.Samplers
{
public static Image Resize(this Image source, int width, int height)
{
- return source.Process(width, height, default(Rectangle), default(Rectangle), new Resize(new BicubicResampler(), width, height));
+ return source.Process(width, height, default(Rectangle), default(Rectangle), new Resize(new BicubicResampler()));
}
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, width, height));
+ return source.Process(width, height, default(Rectangle), default(Rectangle), new Resize(sampler));
}
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, width, height));
+ return source.Process(width, height, sourceRectangle, targetRectangle, new Resize(sampler));
}
}
}
diff --git a/src/ImageProcessor/Samplers/Resize.cs b/src/ImageProcessor/Samplers/Resize.cs
index 48e961828..26dc44d7d 100644
--- a/src/ImageProcessor/Samplers/Resize.cs
+++ b/src/ImageProcessor/Samplers/Resize.cs
@@ -10,15 +10,11 @@ namespace ImageProcessor.Samplers
///
/// The sampler to perform the resize operation.
///
- public Resize(IResampler sampler, int width, int height)
+ public Resize(IResampler sampler)
{
Guard.NotNull(sampler, nameof(sampler));
- Guard.MustBeGreaterThan(width, 0, nameof(width));
- Guard.MustBeGreaterThan(height, 0, nameof(height));
this.Sampler = sampler;
- this.Width = width;
- this.Height = height;
}
///
@@ -26,16 +22,6 @@ namespace ImageProcessor.Samplers
///
public IResampler Sampler { get; }
- ///
- /// Gets the width.
- ///
- public int Width { get; }
-
- ///
- /// Gets the height.
- ///
- public int Height { get; }
-
///
protected override void Apply(
ImageBase target,
@@ -51,6 +37,7 @@ namespace ImageProcessor.Samplers
int width = target.Width;
int height = target.Height;
+ int targetY = targetRectangle.Y;
int startX = targetRectangle.X;
int endX = targetRectangle.Right;
int right = (int)(this.Sampler.Radius + .5);
@@ -69,7 +56,7 @@ namespace ImageProcessor.Samplers
if (y >= 0 && y < height)
{
// Y coordinates of source points.
- double originY = ((startY - targetRectangle.Y) * heightFactor) - 0.5;
+ double originY = ((y - targetY) * heightFactor) - 0.5;
int originY1 = (int)originY;
double dy = originY - originY1;
diff --git a/tests/ImageProcessor.Tests/Filters/FilterTests.cs b/tests/ImageProcessor.Tests/Filters/FilterTests.cs
index 9eed6a977..675bc3815 100644
--- a/tests/ImageProcessor.Tests/Filters/FilterTests.cs
+++ b/tests/ImageProcessor.Tests/Filters/FilterTests.cs
@@ -14,12 +14,12 @@ namespace ImageProcessor.Tests.Filters
{
public static readonly List Files = new List
{
- //{ "../../TestImages/Formats/Jpg/Backdrop.jpg"},
+ { "../../TestImages/Formats/Jpg/Backdrop.jpg"},
//{ "../../TestImages/Formats/Bmp/Car.bmp" },
//{ "../../TestImages/Formats/Png/cmyk.png" },
//{ "../../TestImages/Formats/Gif/a.gif" },
//{ "../../TestImages/Formats/Gif/leaf.gif" },
- { "../../TestImages/Formats/Gif/ani.gif" },
+ //{ "../../TestImages/Formats/Gif/ani.gif" },
//{ "../../TestImages/Formats/Gif/ani2.gif" },
//{ "../../TestImages/Formats/Gif/giphy.gif" },
};