I have run the same code(with packages I needed) before and it worked, not sure what's happening now. This show the error,
AttributeError: module 'PIL.Image' has no attribute 'Resampling'
. Probably it's small issue, but I can't figure it out, I am working in databricks.
I had the same problem. The easy way is use the old version of Pillow.
pip install Pillow==9.0.0
And your code should work.
Note: You can also use
pip install --ignore-installed Pillow==9.0.0
If for some reason, pip is refusing to install it. Note, however, that it can break dependencies, so use it only as a last resort.
I had the same problem and found that I need to replace PIL.Image.Resampling.BICUBIC
with PIL.Image.BICUBIC
.
I am using pillow version 7.1.2
from PIL import Image
im = Image.open('image.png')
im2 = im.resize((512,512),resample=Image.BICUBIC)
display(im2)
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