mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 09:56:17 +03:00
round pixel values
This commit is contained in:
parent
ddae12928a
commit
e56aed1a95
|
@ -66,7 +66,7 @@ class TestImageOpsUsm(PillowTestCase):
|
||||||
|
|
||||||
def test_blur_accuracy(self):
|
def test_blur_accuracy(self):
|
||||||
|
|
||||||
i = snakes._new(ImageOps.gaussian_blur(snakes, .9))
|
i = snakes._new(ImageOps.gaussian_blur(snakes, 1))
|
||||||
# Alpha channel must match whole.
|
# Alpha channel must match whole.
|
||||||
self.assertEqual(i.split()[3], snakes.split()[3])
|
self.assertEqual(i.split()[3], snakes.split()[3])
|
||||||
# These pixels surrounded with pixels with 255 intensity.
|
# These pixels surrounded with pixels with 255 intensity.
|
||||||
|
@ -77,14 +77,14 @@ class TestImageOpsUsm(PillowTestCase):
|
||||||
self.assertEqual(i.im.getpixel((x, y))[c], 255)
|
self.assertEqual(i.im.getpixel((x, y))[c], 255)
|
||||||
# Fuzzy match.
|
# Fuzzy match.
|
||||||
gp = lambda x, y: i.im.getpixel((x, y))
|
gp = lambda x, y: i.im.getpixel((x, y))
|
||||||
self.assertTrue(212 <= gp(7, 4)[0] <= 214)
|
self.assertTrue(211 <= gp(7, 4)[0] <= 213)
|
||||||
self.assertTrue(212 <= gp(7, 5)[2] <= 214)
|
self.assertTrue(211 <= gp(7, 5)[2] <= 213)
|
||||||
self.assertTrue(212 <= gp(7, 6)[2] <= 214)
|
self.assertTrue(211 <= gp(7, 6)[2] <= 213)
|
||||||
self.assertTrue(212 <= gp(7, 7)[1] <= 214)
|
self.assertTrue(211 <= gp(7, 7)[1] <= 213)
|
||||||
self.assertTrue(212 <= gp(8, 4)[0] <= 214)
|
self.assertTrue(211 <= gp(8, 4)[0] <= 213)
|
||||||
self.assertTrue(212 <= gp(8, 5)[2] <= 214)
|
self.assertTrue(211 <= gp(8, 5)[2] <= 213)
|
||||||
self.assertTrue(212 <= gp(8, 6)[2] <= 214)
|
self.assertTrue(211 <= gp(8, 6)[2] <= 213)
|
||||||
self.assertTrue(212 <= gp(8, 7)[1] <= 214)
|
self.assertTrue(211 <= gp(8, 7)[1] <= 213)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
@ -51,7 +51,7 @@ static inline UINT8 clip(double in)
|
||||||
return (UINT8) 255;
|
return (UINT8) 255;
|
||||||
if (in <= 0.0)
|
if (in <= 0.0)
|
||||||
return (UINT8) 0;
|
return (UINT8) 0;
|
||||||
return (UINT8) in;
|
return (UINT8) (in + 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Imaging
|
static Imaging
|
||||||
|
|
Loading…
Reference in New Issue
Block a user