mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 01:16: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():
|
@pytest.mark.parametrize("mode", ("P", "PA"))
|
||||||
im = hopper("P")
|
def test_palette(mode):
|
||||||
|
im = hopper(mode)
|
||||||
|
|
||||||
# Expand
|
# Expand
|
||||||
expanded_im = ImageOps.expand(im)
|
expanded_im = ImageOps.expand(im)
|
||||||
|
|
|
@ -398,7 +398,7 @@ def expand(image, border=0, fill=0):
|
||||||
width = left + image.size[0] + right
|
width = left + image.size[0] + right
|
||||||
height = top + image.size[1] + bottom
|
height = top + image.size[1] + bottom
|
||||||
color = _color(fill, image.mode)
|
color = _color(fill, image.mode)
|
||||||
if image.mode == "P" and image.palette:
|
if image.palette:
|
||||||
palette = ImagePalette.ImagePalette(palette=image.getpalette())
|
palette = ImagePalette.ImagePalette(palette=image.getpalette())
|
||||||
if isinstance(color, tuple):
|
if isinstance(color, tuple):
|
||||||
color = palette.getcolor(color)
|
color = palette.getcolor(color)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user