From e1600389fcccf31f54d693f6e6b25ef76502e3ce Mon Sep 17 00:00:00 2001 From: miruka Date: Sun, 3 Nov 2019 14:08:29 -0400 Subject: [PATCH] Upload 800x600 thumbnails instead of 512x512 Maximum thumbnail size, match Riot's behavior. --- src/python/matrix_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python/matrix_client.py b/src/python/matrix_client.py index a3bee821..aa2dcd1c 100644 --- a/src/python/matrix_client.py +++ b/src/python/matrix_client.py @@ -417,7 +417,7 @@ class MatrixClient(nio.AsyncClient): try: thumb = PILImage.open(path) - small = thumb.width <= 512 and thumb.height <= 512 + small = thumb.width <= 800 and thumb.height <= 600 is_jpg_png = thumb.format in ("JPEG", "PNG") opaque_png = thumb.format == "PNG" and thumb.mode != "RGBA" @@ -425,7 +425,7 @@ class MatrixClient(nio.AsyncClient): raise UneededThumbnail() if not small: - thumb.thumbnail((512, 512), PILImage.LANCZOS) + thumb.thumbnail((800, 600), PILImage.LANCZOS) with io.BytesIO() as out: if thumb.mode == "RGBA":