Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Tests/test_image_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ def convert_transparency(
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"))
Expand Down
Loading