PhotoImage zoom PhotoImage zoom tkinter tkinter

PhotoImage zoom


img1 has no method zoom, however img1._PhotoImage__photo does. So just change your code to:

import tkinter as tkfrom PIL import Image as PIL_image, ImageTk as PIL_imagetkwindow = tk.Tk()img1 = PIL_imagetk.PhotoImage(file="C:\\Two.jpg")img1 = img1._PhotoImage__photo.zoom(2)label =  tk.Label(window, image=img1)label.pack()window.mainloop()

By the way if you want to reduce the image you can use the method subsample img1 = img1._PhotoImage__photo.subsample(2) reduces the picture by half.

If you have a PIL Image, then you can use resize like following example:

import tkinter as tkfrom PIL import Image, ImageTkwindow = tk.Tk()image = Image.open('C:\\Two.jpg')image = image.resize((200, 200), Image.ANTIALIAS)img1 = ImageTk.PhotoImage(image=image)label = tk.Label(window, image=img1)label.pack()window.mainloop()

Note I just import Image and ImageTk, see no need to rename to PIL_image and PIL_imagetk, which to me is only confusing