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

fix PIL sample mode deprecated warning (#42307)

* fix PIL sample mode deprecated warning

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