mirror of
https://github.com/rommapp/romm.git
synced 2026-02-18 23:42:07 +01:00
dinamic ratio for small artwork
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user