wagtail / Willow

A wrapper that combines the functionality of multiple Python image libraries into one API
https://willow.wagtail.org/
BSD 3-Clause "New" or "Revised" License
273 stars 53 forks source link

Clean up `auto_orient` logic #138

Closed Stormheg closed 10 months ago

Stormheg commented 10 months ago

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.

Stormheg commented 10 months ago

Removing code feels so good 😛

image
Stormheg commented 10 months ago

As it turns out, a very similar change is proposed in #136. Closing this in favour of that PR!