From 7dfbcc9a0b1669fc9933df8355cf09e61d1da4d6 Mon Sep 17 00:00:00 2001 From: zurdi Date: Wed, 26 Jun 2024 19:37:50 +0200 Subject: [PATCH] dinamic ratio for small artwork --- backend/handler/filesystem/resources_handler.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/handler/filesystem/resources_handler.py b/backend/handler/filesystem/resources_handler.py index 5fcbcba9c..4c13d0c54 100644 --- a/backend/handler/filesystem/resources_handler.py +++ b/backend/handler/filesystem/resources_handler.py @@ -38,8 +38,12 @@ class FSResourcesHandler(FSHandler): def resize_cover_to_small(cover_path: str): """Path of the cover image to resize""" cover = Image.open(cover_path) - small_width = int(cover.width * 0.1) - small_height = int(cover.height * 0.1) + if cover.height >= 1000: + ratio = 0.2 + else: + ratio = 0.4 + small_width = int(cover.width * ratio) + small_height = int(cover.height * ratio) small_size = (small_width, small_height) small_img = cover.resize(small_size) small_img.save(cover_path)