Posts: 741
Threads: 122
Joined: Dec 2017
HI,
I have an app that uses (PIL) Image.LANCZOS while resizing a TIF file.
The app runs fine on windows 11. No messages.
It also runs fine on my laptop with windows 10. But it produces a warning message
that Image.LANCZOS is going to be deprecated in 2023 and replaced by : Image.Resampling.LANCZOS
When I replace Image.LANCZOS by Image.Resampling.LANCZOS, i get an error.
What should I try?
thx,
Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Posts: 741
Threads: 122
Joined: Dec 2017
Thanks Gribouillis.
Runs smoothly on win 11 and win 10.
Win 10 still produces the message:
Output:
Warning (from warnings module):
File "C:\VVF\20220523\search.py", line 129
resized_img = img.resize((newW,newH),Image.LANCZOS)
DeprecationWarning: LANCZOS is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS instead.
I also import PIL:
Output:
from PIL import ImageTk, Image
Not a big deal, but why refer to a release that is a year away?
thx,
Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Posts: 741
Threads: 122
Joined: Dec 2017
May-28-2022, 09:35 AM
(This post was last modified: May-28-2022, 09:36 AM by DPaul.)
I have a partial explanation, but no solution yet.
1) Running win 11, no warning -->Pillow 9.0 was installed !
2) running win 10, warning --> Pillow 9.1 was installed !
I have upgraded both to 9.1.1, and now both give the warning.
I'll need to try the second suggestion. UPDATE: (tried it, still a warning)
thx,
Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Posts: 741
Threads: 122
Joined: Dec 2017
Quote:Read perhaps the pymotw3 about warnings for hints about how to silence these warnings.
After some trial and error, this seems to do the trick:
with warnings.catch_warnings():
warnings.simplefilter('ignore')
resized_img = img.resize((newW,newH),Image.LANCZOS)
Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.