mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 09:56:17 +03:00
Merge pull request #3163 from radarhere/fillcolor
Fixed transform fillcolor argument when image mode is RGBA or LA
This commit is contained in:
commit
48dda53c12
|
@ -53,7 +53,12 @@ class TestImageTransform(PillowTestCase):
|
|||
self.assert_image_equal(transformed, scaled)
|
||||
|
||||
def test_fill(self):
|
||||
im = hopper('RGB')
|
||||
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,
|
||||
|
@ -61,7 +66,7 @@ class TestImageTransform(PillowTestCase):
|
|||
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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user