0

I am trying to import a photo into a canvas that I made with "tkinter". I used this line of coad to load it: img = PhotoImage(file="image1.ppm") but then I get the error it can't recognize the data. Why is this happening? When I download an image as a ppm. file it automaticly gets stored as a "gimp" file. Is this where the problem occours?

Brage
  • 3
  • 1
  • I think that `tkinter.PhotoImage` doesn't recognise the `.ppm` format. Try using `PIL` to open the image then use `PIL.ImageTk.PhotoImage` to convert it into an tkinter image. For more info on how to use `PIL` with `tkinter` read [this](https://stackoverflow.com/a/18369957/11106801) – TheLizzard Mar 21 '21 at 10:27
  • ppm works with tkinter.PhotoImage, i am using it – hussic Mar 21 '21 at 11:04

0 Answers0