Answers for "make image fit to size tkinter"

4

how to rezize image in python tkinter

from tkinter import *
from PIL import ImageTk, Image
root=Tk()

image = Image.open('path_to_your_image.png')
# The (450, 350) is (height, width)
image = image.resize((450, 350), Image.ANTIALIAS)
my_img = ImageTk.PhotoImage(image)
my_img = Label(image = my_img)
my_img.pack()

root.mainloop()
Posted by: Guest on May-05-2020
0

make image fit to size tkinter

from tkinter import *
from PIL import ImageTk, Image
root=Tk()

image = Image.open('path_to_your_image.png')
# The (450, 350) is (height, width)
image = image.resize((450, 350), Image.ANTIALIAS)
my_img = ImageTk.PhotoImage(image)
# Slightly modified, this works for me
my_lbl = Label(image = my_img)
my_lbl.pack()

root.mainloop()
Posted by: Guest on June-29-2021

Code answers related to "make image fit to size tkinter"

Python Answers by Framework

Browse Popular Code Answers by Language