diff --git a/Tests/test_image_transform.py b/Tests/test_image_transform.py index 9cb6ac2c2..add8cc5e7 100644 --- a/Tests/test_image_transform.py +++ b/Tests/test_image_transform.py @@ -53,15 +53,20 @@ class TestImageTransform(PillowTestCase): self.assert_image_equal(transformed, scaled) def test_fill(self): - im = hopper('RGB') - (w, h) = im.size - transformed = im.transform(im.size, Image.EXTENT, - (0, 0, - w*2, h*2), - Image.BILINEAR, - fillcolor='red') + for mode, pixel in [ + ['RGB', (255, 0, 0)], + ['RGBA', (255, 0, 0, 255)], + ['LA', (76, 0)] + ]: + im = hopper(mode) + (w, h) = im.size + transformed = im.transform(im.size, Image.EXTENT, + (0, 0, + w*2, h*2), + Image.BILINEAR, + fillcolor='red') - self.assertEqual(transformed.getpixel((w-1, h-1)), (255, 0, 0)) + self.assertEqual(transformed.getpixel((w-1, h-1)), pixel) def test_mesh(self): # this should be a checkerboard of halfsized hoppers in ul, lr diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 1954c52ee..30d0f5f9b 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -2115,11 +2115,11 @@ class Image(object): if self.mode == 'LA': return self.convert('La').transform( - size, method, data, resample, fill).convert('LA') + size, method, data, resample, fill, fillcolor).convert('LA') if self.mode == 'RGBA': return self.convert('RGBa').transform( - size, method, data, resample, fill).convert('RGBA') + size, method, data, resample, fill, fillcolor).convert('RGBA') if isinstance(method, ImageTransformHandler): return method.transform(size, self, resample=resample, fill=fill)