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] tools: fix orientation of image with EXIF orientation tag #37448
Conversation
585e95c
to
44f22fe
Compare
44f22fe
to
fd51b84
Compare
Note that since python-pillow/Pillow#4063 Pillow seems to do it by default, but only for TIFF files. Might need to add an ugly hack to avoid doing the job when Pillow already does it if we want to support multiple versions at the same time. |
@mart-e I would like your opinion on this PR and also the above comment. |
We do that from time to time, it is acceptable. (still need to review the patch) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the detailed report and the test.
Could be good to mention https://magnushoff.com/articles/jpeg-orientation/ as the description of the issue in the commit message.
https://packages.debian.org/buster/python-pil As of today, python-pillow is at 5.4 in the latest debian release This allows to deprecate the older versions progessively Newer versions have new features like the exif_transpose method in 6.0 as discussed at odoo#37448
TODO:
maybe also add a condition on type jpeg for the condition on getexif |
https://packages.debian.org/buster/python-pil As of today, python-pillow is at 5.4 in the latest debian release This allows to deprecate the older versions progessively Newer versions have new features like the exif_transpose method in 6.0 as discussed at #37448 closes #38189 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
https://packages.debian.org/buster/python-pil As of today, python-pillow is at 5.4 in the latest debian release This allows to deprecate the older versions progessively Newer versions have new features like the exif_transpose method in 6.0 as discussed at odoo#37448 X-original-commit: 4ad7a99
self todo also retarget to 13 since 12.4 is dead |
https://packages.debian.org/buster/python-pil As of today, python-pillow is at 5.4 in the latest debian release This allows to deprecate the older versions progessively Newer versions have new features like the exif_transpose method in 6.0 as discussed at #37448 closes #38245 X-original-commit: 4ad7a99 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
fd51b84
to
2855826
Compare
Before this commit, some images would display incorrectly orientated. This typically happens for images taken from a non-standard orientation by some phones or other devices that are able to report orientation. The specified transposition is applied to the image before all other operations, because all of them expect the image to be in its final orientation, which is the case only when the first row of pixels is the top of the image and the first column of pixels is the left of the image. Moreover the EXIF tags will not be kept when the image is later saved, so the transposition has to be done to ensure the final image is correctly orientated.
2855826
to
b3b5566
Compare
I had to make some adaptations: mainly extracting Hopefully this should be good now, rebased, re-targeted, and added the Pillow 6 function. I don't really like adding a link in the commit message as it could always become broken at some point. I think I have commented enough, and this PR will be linked anyway. |
@robodoo r+ |
Before this commit, some images would display incorrectly orientated. This typically happens for images taken from a non-standard orientation by some phones or other devices that are able to report orientation. The specified transposition is applied to the image before all other operations, because all of them expect the image to be in its final orientation, which is the case only when the first row of pixels is the top of the image and the first column of pixels is the left of the image. Moreover the EXIF tags will not be kept when the image is later saved, so the transposition has to be done to ensure the final image is correctly orientated. closes #37448 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Staging failed: ci/runbot on 26f631a6ad9b334f1a8f061c6d45a1192ac377db (view more at http://runbot.odoo.com/runbot/build/651601) |
robodoo retry |
Merged at 0f8e132, thanks! |
Before this commit, some images would display incorrectly orientated.
This typically happens for images taken from a non-standard orientation
by some phones or other devices that are able to report orientation.
The specified transposition is applied to the image before all other
operations, because all of them expect the image to be in its final
orientation, which is the case only when the first row of pixels is the top
of the image and the first column of pixels is the left of the image.
Moreover the EXIF tags will not be kept when the image is later saved, so
the transposition has to be done to ensure the final image is correctly
orientated.