Merge pull request #6559 from radarhere/photoimage

This commit is contained in:
Hugo van Kemenade 2022-09-24 13:26:23 +03:00 committed by GitHub
commit 3a30a87139
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -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:

View File

@ -107,6 +107,7 @@ class PhotoImage:
mode = image.mode
if mode == "P":
# palette mapped data
image.apply_transparency()
image.load()
try:
mode = image.palette.mode