Avigdor
Avigdor

Reputation: 21

How do I change the resolution of an image in Tkinter?

I wish to change the resolution of an image before displaying it. when I use this code:

from tkinter import *
from PIL import ImageTk, Image
...
my_image = my_image.resize((128, 128), Image.ANTIALIAS)

I get the message:

AttributeError: 'PhotoImage' object has no attribute 'resize'

What do I do wrong?

Upvotes: 2

Views: 578

Answers (1)

Aarjav Kumar Jain
Aarjav Kumar Jain

Reputation: 66

You can try this:

PIL.Image.open('Your image location').resize(128,128)

Upvotes: 2

Related Questions