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

Fix mypy against latest pillow stubs #12671

Merged
merged 2 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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