mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 10:26:19 +03:00
Merge branch 'master' into fast-filters
# Conflicts: # libImaging/Filter.c
This commit is contained in:
commit
49492def9b
BIN
Tests/images/hopper_emboss.bmp
Normal file
BIN
Tests/images/hopper_emboss.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
BIN
Tests/images/hopper_emboss_more.bmp
Normal file
BIN
Tests/images/hopper_emboss_more.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
|
@ -94,6 +94,28 @@ class TestImageFilter(PillowTestCase):
|
|||
self.assertEqual(rankfilter.size, 1)
|
||||
self.assertEqual(rankfilter.rank, 2)
|
||||
|
||||
def test_consistency_3x3(self):
|
||||
im = Image.open("Tests/images/hopper.bmp")
|
||||
emboss = im.filter(ImageFilter.Kernel((3, 3),
|
||||
(-1, -1, 0,
|
||||
-1, 0, 1,
|
||||
0, 1, 1), .3))
|
||||
|
||||
self.assert_image_equal(
|
||||
emboss, Image.open("Tests/images/hopper_emboss.bmp"))
|
||||
|
||||
def test_consistency_5x5(self):
|
||||
im = Image.open("Tests/images/hopper.bmp")
|
||||
emboss = im.filter(ImageFilter.Kernel((5, 5),
|
||||
(-1, -1, -1, -1, 0,
|
||||
-1, -1, -1, 0, 1,
|
||||
-1, -1, 0, 1, 1,
|
||||
-1, 0, 1, 1, 1,
|
||||
0, 1, 1, 1, 1), 0.3))
|
||||
|
||||
self.assert_image_equal(
|
||||
emboss, Image.open("Tests/images/hopper_emboss_more.bmp"))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
2
_webp.c
2
_webp.c
|
@ -247,7 +247,7 @@ PyObject* WebPDecoderVersion_wrapper(PyObject* self, PyObject* args){
|
|||
* The version of webp that ships with (0.1.3) Ubuntu 12.04 doesn't handle alpha well.
|
||||
* Files that are valid with 0.3 are reported as being invalid.
|
||||
*/
|
||||
int WebPDecoderBuggyAlpha() {
|
||||
int WebPDecoderBuggyAlpha(void) {
|
||||
return WebPGetDecoderVersion()==0x0103;
|
||||
}
|
||||
|
||||
|
|
|
@ -136,6 +136,9 @@ ImagingFilter(Imaging im, int xsize, int ysize, const FLOAT32* kernel,
|
|||
if (!imOut)
|
||||
return NULL;
|
||||
|
||||
// Add one time for rounding
|
||||
offset += 0.5;
|
||||
|
||||
#define KERNEL5x5(image, kernel, d) ( \
|
||||
(int) image[y+2][x-d-d] * kernel[0] + \
|
||||
(int) image[y+2][x-d] * kernel[1] + \
|
||||
|
|
Loading…
Reference in New Issue
Block a user