Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resized avatar getting double rotation in Safari #207

Closed
siovene opened this issue Mar 18, 2022 · 4 comments
Closed

Resized avatar getting double rotation in Safari #207

siovene opened this issue Mar 18, 2022 · 4 comments

Comments

@siovene
Copy link

siovene commented Mar 18, 2022

Images with an EXIF rotation get rotated two times when using Safari.

  • The first time the rotation is hardcoded because of transpose_image in models.py
  • Then Safari sees that the resulting thumbnail still has an EXIF rotation header, and rotates it again

Since the generated thumbnail is transposed, shouldn't the EXIF rotation header be dropped in the thumbnail?

Thanks!

@siovene
Copy link
Author

siovene commented Mar 18, 2022

Please see this:

python-pillow/Pillow#4537

@siovene
Copy link
Author

siovene commented Mar 18, 2022

Replacing transpose_image with the following code fixes the issue for me:

        def transpose_image(self, image):
            EXIF_ORIENTATION = 0x0112
            code = image.getexif().get(EXIF_ORIENTATION, 1)
            if code and code != 1:
                image = ImageOps.exif_transpose(image)

            return image

@johanneswilm
Copy link
Member

@siovene It's a bit unclear - does this only happen for older versions of Pillow or also newer ones? I don't have a mac, so I cannot easily test this. But if someone contributes a PR and others can verify that it is working, I work on merging it.

@siovene
Copy link
Author

siovene commented Aug 16, 2022

Thanks for fixing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants