Move away from bespoke logic and rely on ImageOps.exif_transpose(). This method works much better than our own as it also supports reading XMP metadata instead of just EXIF.
In addition, it also removes the orientation metadata from the transposed image.
Move away from bespoke logic and rely on
ImageOps.exif_transpose()
. This method works much better than our own as it also supports reading XMP metadata instead of just EXIF.In addition, it also removes the orientation metadata from the transposed image.
This method was added in Pillow 6.0.0. See: https://github.com/python-pillow/Pillow/blob/28c173f8d4767c7f6dd22dc840117fe641f4d3ee/docs/releasenotes/6.0.0.rst#added-imageopsexif_transpose
This fixes #137 in the process by removing stale orientation metadata.