Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent de98877 commit 2312f5aCopy full SHA for 2312f5a
tutorials/introductory/images.py
@@ -245,7 +245,12 @@
245
from PIL import Image
246
247
img = Image.open('../../doc/_static/stinkbug.png')
248
-img.thumbnail((64, 64), Image.Resampling.LANCZOS) # resizes image in-place
+# Deal with different versions of Pillow
249
+if Image.hasattr('Resampling'):
250
+ resamplingstrategy = Image.Resampling.LANCZOS
251
+else:
252
+ resamplingstrategy = Image.LANCZOS
253
+img.thumbnail((64, 64), resamplingstrategy) # resizes image in-place
254
imgplot = plt.imshow(img)
255
256
###############################################################################
0 commit comments