mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 17:06:16 +03:00
Copy palette in expand() for PA
This commit is contained in:
parent
279ddf4ce6
commit
3c42b270b9
|
@ -130,8 +130,9 @@ def test_pad():
|
|||
)
|
||||
|
||||
|
||||
def test_palette():
|
||||
im = hopper("P")
|
||||
@pytest.mark.parametrize("mode", ("P", "PA"))
|
||||
def test_palette(mode):
|
||||
im = hopper(mode)
|
||||
|
||||
# Expand
|
||||
expanded_im = ImageOps.expand(im)
|
||||
|
|
|
@ -398,7 +398,7 @@ def expand(image, border=0, fill=0):
|
|||
width = left + image.size[0] + right
|
||||
height = top + image.size[1] + bottom
|
||||
color = _color(fill, image.mode)
|
||||
if image.mode == "P" and image.palette:
|
||||
if image.palette:
|
||||
palette = ImagePalette.ImagePalette(palette=image.getpalette())
|
||||
if isinstance(color, tuple):
|
||||
color = palette.getcolor(color)
|
||||
|
|
Loading…
Reference in New Issue
Block a user