From d48cedd70adac5d52f392aadad83c2594d65e89a Mon Sep 17 00:00:00 2001 From: xtaodada Date: Fri, 13 Sep 2024 20:31:29 +0800 Subject: [PATCH] :bug: Fix post image crop size --- modules/apihelper/models/genshin/hyperion.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/apihelper/models/genshin/hyperion.py b/modules/apihelper/models/genshin/hyperion.py index cf40291..362fbda 100644 --- a/modules/apihelper/models/genshin/hyperion.py +++ b/modules/apihelper/models/genshin/hyperion.py @@ -50,7 +50,7 @@ class ArtworkImage(BaseModel): width, height = image.size crop_height = height crop_num = 1 - max_height = 10000 - width + max_height = 8000 - width while crop_height > max_height: crop_num += 1 crop_height = height / crop_num @@ -58,9 +58,9 @@ class ArtworkImage(BaseModel): for i in range(crop_num): slice_image = image.crop((0, crop_height * i, width, crop_height * (i + 1))) bio = BytesIO() - slice_image.save(bio, "png") + slice_image.save(bio, "JPEG", quality=95) kwargs["data"] = bio.getvalue() - kwargs["file_extension"] = "png" + kwargs["file_extension"] = "jpg" new_data.append(ArtworkImage(*args, **kwargs)) return new_data except UnidentifiedImageError: