mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 14:33:50 +01:00
Pick larger than desired thumbnail for 'crop'
This commit is contained in:
parent
4e2e67fd50
commit
103e1c2431
1 changed files with 2 additions and 1 deletions
|
@ -162,11 +162,12 @@ class ThumbnailResource(BaseMediaResource):
|
||||||
t_method = info["thumbnail_method"]
|
t_method = info["thumbnail_method"]
|
||||||
if t_method == "scale" or t_method == "crop":
|
if t_method == "scale" or t_method == "crop":
|
||||||
aspect_quality = abs(d_w * t_h - d_h * t_w)
|
aspect_quality = abs(d_w * t_h - d_h * t_w)
|
||||||
|
min_quality = 0 if d_w <= t_w and d_h <= t_h else 1
|
||||||
size_quality = abs((d_w - t_w) * (d_h - t_h))
|
size_quality = abs((d_w - t_w) * (d_h - t_h))
|
||||||
type_quality = desired_type != info["thumbnail_type"]
|
type_quality = desired_type != info["thumbnail_type"]
|
||||||
length_quality = info["thumbnail_length"]
|
length_quality = info["thumbnail_length"]
|
||||||
info_list.append((
|
info_list.append((
|
||||||
aspect_quality, size_quality, type_quality,
|
aspect_quality, min_quality, size_quality, type_quality,
|
||||||
length_quality, info
|
length_quality, info
|
||||||
))
|
))
|
||||||
if info_list:
|
if info_list:
|
||||||
|
|
Loading…
Reference in a new issue