未验证 提交 eae41b7d 编写于 作者: L LielinJiang 提交者: GitHub

fix PIL sample mode deprecated warning (#42307) (#42451)

* fix PIL sample mode deprecated warning

* compatible with old pil version
上级 713d5a4b
......@@ -32,14 +32,25 @@ else:
Sequence = collections.abc.Sequence
Iterable = collections.abc.Iterable
_pil_interp_from_str = {
'nearest': Image.NEAREST,
'bilinear': Image.BILINEAR,
'bicubic': Image.BICUBIC,
'box': Image.BOX,
'lanczos': Image.LANCZOS,
'hamming': Image.HAMMING
}
try:
# PIL version >= "9.1.0"
_pil_interp_from_str = {
'nearest': Image.Resampling.NEAREST,
'bilinear': Image.Resampling.BILINEAR,
'bicubic': Image.Resampling.BICUBIC,
'box': Image.Resampling.BOX,
'lanczos': Image.Resampling.LANCZOS,
'hamming': Image.Resampling.HAMMING
}
except:
_pil_interp_from_str = {
'nearest': Image.NEAREST,
'bilinear': Image.BILINEAR,
'bicubic': Image.BICUBIC,
'box': Image.BOX,
'lanczos': Image.LANCZOS,
'hamming': Image.HAMMING
}
__all__ = []
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册