tkinter.PhotoImage
only support GM, PPM, GIF, PNG
image.Your image is JPEG
,for sure it will raise Exception.
There are some solutions,but the direct way is to change the image extension to ico
and use iconbitmap()
from PIL import Imageimg = Image.open(r"xxx.jpeg") # your jpeg image pathimg.save(r"Icon.ico")
This will generate a new ico
image in your current path.
Then you can use iconbitmap('Icon.ico')
directly.