diff --git a/Tests/test_image_resample.py b/Tests/test_image_resample.py index 3bb941438..e94fbfe94 100644 --- a/Tests/test_image_resample.py +++ b/Tests/test_image_resample.py @@ -212,6 +212,11 @@ class TestImagingCoreResampleAccuracy(PillowTestCase): for channel in case.split(): self.check_case(channel, self.make_sample(data, (12, 12))) + def test_box_filter_correct_range(self): + im = Image.new("RGB", (8, 8), "#1688ff").resize((100, 100), Image.BOX) + ref = Image.new("RGB", (100, 100), "#1688ff") + self.assert_image_equal(im, ref) + class CoreResampleConsistencyTest(PillowTestCase): def make_case(self, mode, fill): diff --git a/src/libImaging/Resample.c b/src/libImaging/Resample.c index d1a89e2ce..0dc08611d 100644 --- a/src/libImaging/Resample.c +++ b/src/libImaging/Resample.c @@ -13,7 +13,7 @@ struct filter { static inline double box_filter(double x) { - if (x >= -0.5 && x < 0.5) + if (x > -0.5 && x <= 0.5) return 1.0; return 0.0; }