pythontkinterphotoimage

Resize PhotoImage using .zoom or .subsample


I want to resize PhotoImage at load stage. As you know, .zoom and .subsample cannot work with floating variables, only integers. Now I resize it with wrong way:

i1=PhotoImage(file="res\\1h.gif").zoom(new_size).subsample(old_size)

It works with small pictures but now I tried medium picture, and got error:

self.tk.call(destImage, 'copy', self.name, '-zoom',x,y)

_tkinter.TclError: not enough free memory for image buffer


Solution

  • Heyy, if u want resize an PhotoImage, u can use 2 methods :