accept RGBa and La modes for blur

This commit is contained in:
homm 2016-05-19 19:16:34 +03:00
parent 15586c5b59
commit edc9880b61
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);