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
[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().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With