我正在尝试放大图像并使用以下代码显示它
import tkinter as tk
from PIL import Image as PIL_image, ImageTk as PIL_imagetk
window = tk.Tk()
img1 = PIL_imagetk.PhotoImage(file="C:\\Two.jpg")
img1 = img1.zoom(2)
window.mainloop()
但蟒蛇说AttributeError: 'PhotoImage' object has no attribute 'zoom'
。这里有一个相关帖子的评论:
Image resize under PhotoImage 上面
写着“PIL's PhotoImage does not implement zoom from Tkinter's PhotoImage (as well as some other methods)”。
我认为这意味着我需要在我的代码中导入其他内容,但我不确定是什么。任何帮助都会很棒!