I\'m trying to put a jpg image to a tkinter canvas. tkinter gives me this error:
couldn\'t recognize data in image file
I use th
Install PIL/Pillow with:
pip install Pillow
or:
sudo pip install pillow
from PIL import Image
from PIL import ImageTk
import tkinter
image = Image.open('bll.jpg')
image = image.resize((20, 20))
image = ImageTk.PhotoImage(image)
canv = Canvas(root, width=80, height=80, bg='white')
canv.grid(row=2, column=3)
img = PhotoImage(file=image)
Also using .PNG instead of .JPG is better for Tkinter.