Upload 800x600 thumbnails instead of 512x512

Maximum thumbnail size, match Riot's behavior.
This commit is contained in:
miruka 2019-11-03 14:08:29 -04:00
parent 2f19ff493b
commit e1600389fc

View File

@ -417,7 +417,7 @@ class MatrixClient(nio.AsyncClient):
try: try:
thumb = PILImage.open(path) 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") is_jpg_png = thumb.format in ("JPEG", "PNG")
opaque_png = thumb.format == "PNG" and thumb.mode != "RGBA" opaque_png = thumb.format == "PNG" and thumb.mode != "RGBA"
@ -425,7 +425,7 @@ class MatrixClient(nio.AsyncClient):
raise UneededThumbnail() raise UneededThumbnail()
if not small: if not small:
thumb.thumbnail((512, 512), PILImage.LANCZOS) thumb.thumbnail((800, 600), PILImage.LANCZOS)
with io.BytesIO() as out: with io.BytesIO() as out:
if thumb.mode == "RGBA": if thumb.mode == "RGBA":