Merge pull request #4278 from uploadcare/fox-filter-black-lines

Define box filter equal 1.0 on (-0.5, 0.5] range instead of [-0.5, 0.5)
This commit is contained in:
Alexander Karpinsky 2019-12-19 03:26:17 +03:00 committed by GitHub
commit c82d2629d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -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):

View File

@ -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;
}