diff --git a/Tests/test_image_convert.py b/Tests/test_image_convert.py index f596f009025..c0dbb4fabaa 100644 --- a/Tests/test_image_convert.py +++ b/Tests/test_image_convert.py @@ -293,7 +293,7 @@ def test_p2pa_alpha() -> None: def test_p2pa_palette() -> None: with Image.open("Tests/images/tiny.png") as im: im_pa = im.convert("PA") - assert im_pa.getpalette() == im.getpalette() + assert im_pa.getpalette(None) == im.getpalette() rgb2xyz_matrix = ( diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 13a761eabf3..62a3317a376 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -1249,7 +1249,7 @@ def convert_transparency( if mode in ("P", "PA") and palette != Palette.ADAPTIVE: from . import ImagePalette - new_im.palette = ImagePalette.ImagePalette("RGB", im.getpalette("RGB")) + new_im.palette = ImagePalette.raw("RGB", im.getpalette("RGB")) if delete_trns: # crash fail if we leave a bytes transparency in an rgb/l mode. del new_im.info["transparency"]