Closed chepo92 closed 1 month ago
I'm struggling to consistently reproduce your error. Could you try the following simplified version of your code and let us know if there is still a problem?
import os
import tkinter
from PIL import Image, ImageTk
root_tk = tkinter.Tk()
ImageTk.PhotoImage(Image.open("images/airport.jpg"))
Could you also, just for completeness, provide us with a copy of airport.jpg?
Couldn't reproduce with provided code, but that opened my mind and i think I discovered the issue is related with the TkinterMapView library instead, as sometimes is throwing randomly a 403 error for the retrieved tiles, I guess it uses PIL internally to render, then this library complains as there is no image to render, closing this, thanks!
What did you do?
Using tk inter and showing some png and jpeg, depending on how the jpg is imported the library shows some exceptions, eg: if you pass a file path
ImageTk.PhotoImage(file = file_path)
works ok, but passing a PIL imageImageTk.PhotoImage(Image.open(os.path.join(current_path, "images", "airport.jpg")))
throws an exceptionWhat did you expect to happen?
no warnings, no exceptions, not depending on how to pass the image to function or the extension of the image
What actually happened?
Outputs some exceptions when using jpeg images:
What are your OS, Python and Pillow versions?