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

fix: keep image orientation in thumbnail transformation #2742

Merged

Conversation

MathRdt
Copy link

@MathRdt MathRdt commented Oct 6, 2023

Nous sommes tombés sur un cas, où en tentant d'upload une image portrait directement depuis l'API GN, les thumbnails se retrouvaient "rotatés" de 90°.

De ce que j'en comprends c'est une metadata EXIF de la photo qui dit "orientation = 3" et la librairie PIL considère que le vrai sens de l'image est 0, PIL va alors "rotater" l'image de 90° (ou 270°, mais bref).

Je peux essayer de vous fournir des images tests, mais cette metadata semble sauter en cas de transfert du fichier via messagerie ou outil de conversation instantané...

Capture d’écran 2023-10-06 à 14 45 46

Le fix que je propose résout bien le soucis, j'ai aussi testé avec des images PNG qui n'ont pas d'EXIF, et pas d'erreur de la part de l'API. Il y a peut être d'autres edge cases auxquels je n'ai pas pensé.

Issue correspondant à mon cas d'usage côté PIL : python-pillow/Pillow#4703

@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

All modified lines are covered by tests ✅

Files Coverage Δ
backend/geonature/core/gn_commons/repositories.py 81.85% <100.00%> (+0.08%) ⬆️

📢 Thoughts on this report? Let us know!.

@Pierre-Narcisi Pierre-Narcisi merged commit 242ff94 into PnX-SI:develop Oct 6, 2023
8 checks passed
@MathRdt MathRdt deleted the fix/keep-image-orientation branch October 6, 2023 16:14
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

Successfully merging this pull request may close these issues.

None yet

3 participants