mirror of
https://github.com/element-hq/synapse.git
synced 2025-12-05 01:10:13 +00:00
Use Pillow's non-experimental getexif (#19098)
It has been available since Pillow 6, and Synapse is now pinned on Pillow >=10.0.1. Found this while looking at Debian-shipped dependencies, and figured this may as well be updated.
This commit is contained in:
committed by
GitHub
parent
086b887f29
commit
a07dd43ac4
1
changelog.d/19098.misc
Normal file
1
changelog.d/19098.misc
Normal file
@@ -0,0 +1 @@
|
||||
Use Pillow's `Image.getexif` method instead of the experimental `Image._getexif`.
|
||||
@@ -97,16 +97,7 @@ class Thumbnailer:
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user