Answers for "tkinter pil scale image"

10

python pil resize image

from PIL import Image

# Image.open() can also open other image types
img = Image.open("some_random_image.jpg")
# WIDTH and HEIGHT are integers
resized_img = img.resize((WIDTH, HEIGHT))
resized_img.save("resized_image.jpg")
Posted by: Guest on April-05-2020
0

python tkinter get image size

img = Image.open("path\to\image.jpg")
tkimage = ImageTk.PhotoImage(img)

h = tkimage.height()
w = tkimage.width()
print(h)
print(w)
Posted by: Guest on October-02-2020

Python Answers by Framework

Browse Popular Code Answers by Language