mirror of
https://github.com/Murasame-Dev/McStatus-Img.git
synced 2025-12-16 13:17:40 +00:00
fix
This commit is contained in:
parent
e89c0ae147
commit
1528211538
1 changed files with 6 additions and 5 deletions
|
|
@ -56,16 +56,17 @@ def create_image(background: bytes,
|
|||
text_list: list[str],
|
||||
motd_list: list[str],
|
||||
font_url: str | None,
|
||||
image_size: list[int] = [0, 0]):
|
||||
image_size: tuple[int, int] = (0, 0)):
|
||||
# 图片尺寸
|
||||
if type(image_size) == type(list()) and len(image_size) == 0:
|
||||
if type(image_size) != type(tuple()) or len(image_size) != 2:
|
||||
assert ValueError("image_size is invalid")
|
||||
|
||||
if image_size[0] == 0 and image_size[1] == 0:
|
||||
width = 1200
|
||||
height = 400
|
||||
elif len(image_size) == 2:
|
||||
else:
|
||||
width = image_size[0]
|
||||
height = image_size[1]
|
||||
else:
|
||||
assert ValueError("image_size is invalid")
|
||||
|
||||
if (len(text_list) + len(motd_list)) * 20 + 20 > height:
|
||||
height = (len(text_list) + len(motd_list)) * 20 + 20
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue