Python 如何更改Tkinter中图像的分辨率?

Python 如何更改Tkinter中图像的分辨率?,python,tkinter,python-imaging-library,resolution,Python,Tkinter,Python Imaging Library,Resolution,我希望在显示图像之前更改图像的分辨率。 当我使用此代码时: 从tkinter导入* 从PIL导入ImageTk,图像 ... my_image=my_image.resize((128128),image.ANTIALIAS) 我得到的信息是: AttributeError: 'PhotoImage' object has no attribute 'resize' 我做错了什么?您可以尝试以下方法: PIL.Image.open('Your image location').resize(

我希望在显示图像之前更改图像的分辨率。 当我使用此代码时:

从tkinter导入*
从PIL导入ImageTk,图像
...
my_image=my_image.resize((128128),image.ANTIALIAS)
我得到的信息是:

AttributeError: 'PhotoImage' object has no attribute 'resize'
我做错了什么?

您可以尝试以下方法:

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

您需要在原始PIL
图像
上执行调整大小操作,而不是从中创建的
ImageTk
。我不能再具体了,因为您没有显示相关代码。