Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix mypy against latest pillow stubs (#12671)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Robertson authored May 9, 2022
1 parent 41a882e commit 8de0fac
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions changelog.d/12671.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix mypy against latest pillow stubs.
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions synapse/rest/media/v1/thumbnailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ def _resize(self, width: int, height: int) -> Image.Image:
#
# 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:
Expand Down

0 comments on commit 8de0fac

Please sign in to comment.