Merge pull request #1914 from uploadcare/box-blur-alpha

Box blur with premultiplied alpha
This commit is contained in:
wiredfool 2016-05-31 14:40:25 +01:00
commit 6fe8d0f15b
2 changed files with 5 additions and 1 deletions

View File

@ -64,10 +64,12 @@ class TestBoxBlur(PillowTestCase):
self.assertRaises(ValueError, self.box_blur, sample.convert("P"))
self.box_blur(sample.convert("L"))
self.box_blur(sample.convert("LA"))
self.box_blur(sample.convert("LA").convert("La"))
self.assertRaises(ValueError, self.box_blur, sample.convert("I"))
self.assertRaises(ValueError, self.box_blur, sample.convert("F"))
self.box_blur(sample.convert("RGB"))
self.box_blur(sample.convert("RGBA"))
self.box_blur(sample.convert("RGBA").convert("RGBa"))
self.box_blur(sample.convert("CMYK"))
self.assertRaises(ValueError, self.box_blur, sample.convert("YCbCr"))

View File

@ -257,10 +257,12 @@ ImagingBoxBlur(Imaging imOut, Imaging imIn, float radius, int n)
if (!(strcmp(imIn->mode, "RGB") == 0 ||
strcmp(imIn->mode, "RGBA") == 0 ||
strcmp(imIn->mode, "RGBa") == 0 ||
strcmp(imIn->mode, "RGBX") == 0 ||
strcmp(imIn->mode, "CMYK") == 0 ||
strcmp(imIn->mode, "L") == 0 ||
strcmp(imIn->mode, "LA") == 0))
strcmp(imIn->mode, "LA") == 0 ||
strcmp(imIn->mode, "La") == 0))
return ImagingError_ModeError();
imTransposed = ImagingNew(imIn->mode, imIn->ysize, imIn->xsize);