R
R
Roma Kotolup2021-04-24 16:58:25
Python
Roma Kotolup, 2021-04-24 16:58:25

How to find out the size of an image in python tkinter through changes to PhotoImage?

how do i know the size of an image through PhotoImage?
my code:

from tkinter import *
win = Tk()
картинка = PhotoImage(file="C:\питон.gif")]
new_image = картинка.zoom(4, 4)
my_image = new_image.subsample(3, 3)
print(int(my_image.width))
and error: TypeError: int() argument must be a string, a bytes-like object or a number, not 'method'
and how to fix it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
soremix, 2021-04-24
@roma2

my_image.width- the method, which is what the error says. ()Add brackets . Well, it already returns a number, so int is not needed

Y
Yupiter7575, 2021-04-24
@yupiter7575

from PIL import Image
img = Image.open(src)
(width, height) = img.size

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question