Reputation: 577
I'm trying PIL and it is throwing an error which I find strange.
this is all the code I have:
from PIL import Image, ImageOps
im = ("lenna.png")
imResize = Image.resize((200,200), Image.ANTIALIAS)
I'm doing this on command line via Windows Powershell and the first two statements gave
me no problem. Indeed I even tried im.show()
and the image opened but when I tried the imResize
, I get the following error:
AttributeError: 'module' object has no attribute 'resize'
Yet when I go through help(Image)
I can see the resize
method there and I seem to be doing everything alright.
Please is there anything I'm missing? Thanks
Upvotes: 3
Views: 16211
Reputation: 29354
[Putting the answer as an answer :)]
Call the resize method on the variable instead. So im.resize()
gets the job done instead of Image.resize()
.
Upvotes: 6