Skip to content

Commit

Permalink
dinamic ratio for small artwork
Browse files Browse the repository at this point in the history
  • Loading branch information
zurdi15 committed Jun 26, 2024
1 parent 9f93623 commit 7dfbcc9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions backend/handler/filesystem/resources_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ def _cover_exists(rom: Rom, size: CoverSize):
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)
Expand Down

0 comments on commit 7dfbcc9

Please sign in to comment.