This commit is contained in:
Andrew Murray 2025-09-17 03:37:04 -04:00 committed by GitHub
commit 95ba78c751
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -107,6 +107,14 @@ def test_rgba_p() -> None:
assert_image_similar(im, comparable, 20)
def test_pa() -> None:
im = hopper().convert("PA")
palette = im.palette
assert palette is not None
assert palette.colors != {}
def test_rgba() -> None:
with Image.open("Tests/images/transparent.png") as im:
assert im.mode == "RGBA"

View File

@ -1142,7 +1142,7 @@ class Image:
raise ValueError(msg) from e
new_im = self._new(im)
if mode == "P" and palette != Palette.ADAPTIVE:
if mode in ("P", "PA") and palette != Palette.ADAPTIVE:
from . import ImagePalette
new_im.palette = ImagePalette.ImagePalette("RGB", im.getpalette("RGB"))