diff --git a/server/szurubooru/func/images.py b/server/szurubooru/func/images.py index e28520dd..7daf46ff 100644 --- a/server/szurubooru/func/images.py +++ b/server/szurubooru/func/images.py @@ -41,7 +41,7 @@ class Image: def frames(self) -> int: return self.info["streams"][0]["nb_read_frames"] - def resize_fill(self, width: int, height: int) -> None: + def resize_fill(self, width: int, height: int, pixel_format: str = "rgb32") -> None: width_greater = self.width > self.height width, height = (-1, height) if width_greater else (width, -1) @@ -51,7 +51,7 @@ class Image: "-f", "image2", "-filter:v", - "scale='{width}:{height}'".format(width=width, height=height), + "format={pixel_format},scale={width}:{height}:flags=bicubic".format(pixel_format=pixel_format, width=width, height=height), "-map", "0:v:0", "-vframes", diff --git a/server/szurubooru/func/posts.py b/server/szurubooru/func/posts.py index be2259cf..e165fd03 100644 --- a/server/szurubooru/func/posts.py +++ b/server/szurubooru/func/posts.py @@ -689,6 +689,7 @@ def generate_post_thumbnail(post: model.Post) -> None: image.resize_fill( int(config.config["thumbnails"]["post_width"]), int(config.config["thumbnails"]["post_height"]), + "rgb24", ) files.save(get_post_thumbnail_path(post), image.to_jpeg()) except errors.ProcessingError: