From 418bc924c43eed0ffb2bb32a867d13ff3c38c989 Mon Sep 17 00:00:00 2001 From: Martin Milata Date: Wed, 10 Apr 2024 11:24:52 +0200 Subject: [PATCH] fix(python): missing PIL.Image.ANTIALIAS [no changelog] --- python/requirements-optional.txt | 2 +- python/setup.py | 2 +- python/src/trezorlib/cli/settings.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/python/requirements-optional.txt b/python/requirements-optional.txt index 9cb083fae..f5e08485e 100644 --- a/python/requirements-optional.txt +++ b/python/requirements-optional.txt @@ -1,5 +1,5 @@ hidapi>=0.7.99.post20 web3>=5 -Pillow +Pillow>=10 stellar-sdk>=6 rlp>=1.1.0 ; python_version<'3.7' diff --git a/python/setup.py b/python/setup.py index 0b8aed8fa..ccb7b0ac0 100755 --- a/python/setup.py +++ b/python/setup.py @@ -29,7 +29,7 @@ extras_require = { "hidapi": ["hidapi>=0.7.99.post20"], "ethereum": ["rlp>=1.1.0 ; python_version<'3.7'", "web3>=5"], "qt-widgets": ["PyQt5"], - "extra": ["Pillow"], + "extra": ["Pillow>=10"], "stellar": ["stellar-sdk>=6"], } diff --git a/python/src/trezorlib/cli/settings.py b/python/src/trezorlib/cli/settings.py index 635ffe507..19231f3a7 100644 --- a/python/src/trezorlib/cli/settings.py +++ b/python/src/trezorlib/cli/settings.py @@ -64,7 +64,7 @@ def image_to_t1(filename: Path) -> bytes: f"Image is not 128x64, but {image.size}. Do you want to resize it automatically?", default=True, ): - image = image.resize(T1_TR_IMAGE_SIZE, Image.ANTIALIAS) + image = image.resize(T1_TR_IMAGE_SIZE, Image.Resampling.LANCZOS) else: raise click.ClickException("Wrong size of the image - should be 128x64") @@ -99,7 +99,7 @@ def image_to_toif(filename: Path, width: int, height: int, greyscale: bool) -> b f"Image is not {width}x{height}, but {image.size[0]}x{image.size[1]}. Do you want to resize it automatically?", default=True, ): - image = image.resize((width, height), Image.ANTIALIAS) + image = image.resize((width, height), Image.Resampling.LANCZOS) else: raise click.ClickException( f"Wrong size of image - should be {width}x{height}" @@ -137,7 +137,7 @@ def image_to_jpeg(filename: Path, width: int, height: int) -> bytes: f"Image is not {width}x{height}, but {image.size[0]}x{image.size[1]}. Do you want to resize it automatically?", default=True, ): - image = image.resize((width, height), Image.ANTIALIAS) + image = image.resize((width, height), Image.Resampling.LANCZOS) else: raise click.ClickException( f"Wrong size of image - should be {width}x{height}"