-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Fix bug #784 Warnings related to PIL.Image samplers warnings #788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
@Thomas-MMJ so these enums were added in version 9.1.0 and thus were potentially deemed too new to add as many places have older versions of PIL installed... you would also need to add the >= 9.1.0 requirements too in the PR |
also see #588 |
Indeed, let's keep this open until future PIL releases. |
What we usually do here is to do version dependent imports. Could we do the same here @Thomas-MMJ. E.g. could you add the following logic: import PIL
if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("9.1.0"):
self.interpolation = {
"linear": PIL.Image.Resampling.LINEAR,
"bilinear": PIL.Image.Resampling.BILINEAR,
"bicubic": PIL.Image.Resampling.BICUBIC,
"lanczos": PIL.Image.Resampling.LANCZOS,
}
else:
self.interpolation = {
"linear": PIL.Image.LINEAR,
"bilinear": PIL.Image.BILINEAR,
"bicubic": PIL.Image.BICUBIC,
"lanczos": PIL.Image.LANCZOS,
} and could you use the same approach to all the other occurrences? This way we are safe for both PIL versions smaller than 9.1.0 and higher than 9.1.0. |
you can try: if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("9.1.0"):
self.interpolation = {
"linear": PIL.Image.Resampling.BILINEAR,
"bilinear": PIL.Image.Resampling.BILINEAR,
"bicubic": PIL.Image.Resampling.BICUBIC,
"lanczos": PIL.Image.Resampling.LANCZOS,
}
else:
self.interpolation = {
"linear": PIL.Image.LINEAR,
"bilinear": PIL.Image.BILINEAR,
"bicubic": PIL.Image.BICUBIC,
"lanczos": PIL.Image.LANCZOS,
} |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
Think this is handled now by #1309 :-) |
This fixes PIL.Image Resampler warnings, fixing bug #784