summary refs log tree commit diff
path: root/synapse/rest/media/v1
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2022-05-09 11:48:14 +0100
committerGitHub <noreply@github.com>2022-05-09 10:48:14 +0000
commit8de0facaae08c422cbf1acefe898820d3bf5c632 (patch)
tree9af06d33baaae8442c1d718dd64747ec7e444759 /synapse/rest/media/v1
parentUpdate changelog for #12587 to be more accurate (#12663) (diff)
downloadsynapse-8de0facaae08c422cbf1acefe898820d3bf5c632.tar.xz
Fix mypy against latest pillow stubs (#12671)
Diffstat (limited to 'synapse/rest/media/v1')
-rw-r--r--synapse/rest/media/v1/thumbnailer.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/rest/media/v1/thumbnailer.py b/synapse/rest/media/v1/thumbnailer.py
index 5e17664b5b..390491eb83 100644
--- a/synapse/rest/media/v1/thumbnailer.py
+++ b/synapse/rest/media/v1/thumbnailer.py
@@ -121,10 +121,10 @@ class Thumbnailer:
         #
         # If the image has transparency, use RGBA instead.
         if self.image.mode in ["1", "L", "P"]:
-            mode = "RGB"
             if self.image.info.get("transparency", None) is not None:
-                mode = "RGBA"
-            self.image = self.image.convert(mode)
+                self.image = self.image.convert("RGBA")
+            else:
+                self.image = self.image.convert("RGB")
         return self.image.resize((width, height), Image.ANTIALIAS)
 
     def scale(self, width: int, height: int, output_type: str) -> BytesIO: