mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 04:18:10 +00:00
python/trezorctl: fix minor bugs in 'set homescreen'
This commit is contained in:
parent
c52c93aea0
commit
d19f00b26c
@ -38,7 +38,14 @@ def image_to_t1(filename: str) -> bytes:
|
|||||||
"Image library is missing. Please install via 'pip install Pillow'."
|
"Image library is missing. Please install via 'pip install Pillow'."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if filename.endswith(".toif"):
|
||||||
|
raise click.ClickException("TOIF images not supported on Trezor One")
|
||||||
|
|
||||||
|
try:
|
||||||
image = Image.open(filename)
|
image = Image.open(filename)
|
||||||
|
except Exception as e:
|
||||||
|
raise click.ClickException("Failed to load image") from e
|
||||||
|
|
||||||
if image.size != (128, 64):
|
if image.size != (128, 64):
|
||||||
raise click.ClickException("Wrong size of the image - should be 128x64")
|
raise click.ClickException("Wrong size of the image - should be 128x64")
|
||||||
|
|
||||||
@ -73,7 +80,6 @@ def image_to_tt(filename: str) -> bytes:
|
|||||||
if toif_image.mode != firmware.ToifMode.full_color:
|
if toif_image.mode != firmware.ToifMode.full_color:
|
||||||
raise click.ClickException("Wrong image mode - should be full_color")
|
raise click.ClickException("Wrong image mode - should be full_color")
|
||||||
|
|
||||||
toif_image = toif.from_image(image)
|
|
||||||
return toif_image.to_bytes()
|
return toif_image.to_bytes()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user