Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhotoImage instance has no attribute 'resize'

Im geting the error 'PhotoImage instance has no attribute 'resize'' despite multiple online sources stating that this is the way to do resize an image using PIL. Any Ideas?

relevant code:

Deathwing = ImageTk.PhotoImage(Image.open('Deathwing.PNG'))

Deathwing2=Deathwing.resize((100,50),Image.ANTIALIAS)

picture1=Label(pictures_frame,image=Deathwing2)

picture1.grid(column=1,row=1)

and PIL is impoted as:

from PIL import Image,ImageTk
like image 620
Freddie Cooke Avatar asked Mar 17 '26 08:03

Freddie Cooke


1 Answers

For anyone who has the same problem I fixed it by doing:

 deathwing=Image.open('Deathwing.PNG')
 image2=deathwing.resize((100,50),Image.ANTIALIAS)
 Deathwing2=ImageTk.PhotoImage(image2)
like image 96
Freddie Cooke Avatar answered Mar 18 '26 21:03

Freddie Cooke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!