python - 如何在 Tkinter 中更改图像的分辨率?

标签 python tkinter python-imaging-library resolution

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

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

我收到消息:

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

我做错了什么?

最佳答案

你可以试试这个:

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

关于python - 如何在 Tkinter 中更改图像的分辨率?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62701205/

相关文章:

python - 在 Python 中从 PDF 中提取页面大小

python - Apache + mod_wsgi/Lighttpd + wsgi - 我会看到性能差异吗?

python - 如何使用Python GUI自定义按钮和文本框?

python - 如何防止 tkinter python 中的 float 小部件

python - 可以同时创建和放置一个 tkinter 小部件吗?

python - 如何在 Windows 上的 Python 中将 HEIC 转换为 JPG

python - 如何将 numpy 矩阵转换为 bool 矩阵?

python - Pandas Groupby 在不同轴上使用多个标准

python - 带 PIL 的彩色文本

python - 将文本写入具有最大像素宽度的图像 Python PIL