Skip to content

Commit

Permalink
Merge pull request #6559 from radarhere/photoimage
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Sep 24, 2022
2 parents 53b6e5f + ee5de25 commit 3a30a87
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Tests/test_imagetk.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ def test_photoimage():
assert_image_equal(reloaded, im.convert("RGBA"))


def test_photoimage_apply_transparency():
with Image.open("Tests/images/pil123p.png") as im:
im_tk = ImageTk.PhotoImage(im)
reloaded = ImageTk.getimage(im_tk)
assert_image_equal(reloaded, im.convert("RGBA"))


def test_photoimage_blank():
# test a image using mode/size:
for mode in TK_MODES:
Expand Down
1 change: 1 addition & 0 deletions src/PIL/ImageTk.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def __init__(self, image=None, size=None, **kw):
mode = image.mode
if mode == "P":
# palette mapped data
image.apply_transparency()
image.load()
try:
mode = image.palette.mode
Expand Down

0 comments on commit 3a30a87

Please sign in to comment.