Skip to content
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/19098.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use Pillow's `Image.getexif` method instead of the experimental `Image._getexif`.
11 changes: 1 addition & 10 deletions synapse/media/thumbnailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,7 @@ def __init__(self, input_path: str):
self.transpose_method = None
try:
# We don't use ImageOps.exif_transpose since it crashes with big EXIF
#
# Ignore safety: Pillow seems to acknowledge that this method is
# "private, experimental, but generally widely used". Pillow 6
# includes a public getexif() method (no underscore) that we might
# consider using instead when we can bump that dependency.
#
# At the time of writing, Debian buster (currently oldstable)
# provides version 5.4.1. It's expected to EOL in mid-2022, see
# https://wiki.debian.org/DebianReleases#Production_Releases
image_exif = self.image._getexif() # type: ignore
image_exif = self.image.getexif()
if image_exif is not None:
image_orientation = image_exif.get(EXIF_ORIENTATION_TAG)
assert type(image_orientation) is int # noqa: E721
Expand Down
Loading