-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Exif writing fixes: Rational boundaries and signed/unsigned types #3980
Conversation
ed2913c
to
524933a
Compare
I am totally dropping the ball at this one. This seems to fix #4037. I didn't add very specific test case for it; it's kind of covered by same condition for RATIONAL/STRATIONAL tests. Let me know if I should add a specific test. |
Corrected short and long range checks
# Conflicts: # Tests/test_file_tiff_metadata.py
Let me know, if you prefer this rebased/squashed. |
original[k] = tuple( | ||
IFDRational(*_limit_rational(elt, 2 ** 31)) for elt in v | ||
) | ||
|
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.
Why remove this part of the test?
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.
It seems disfunctional and wrong.
The fact that Pillow used to incorrectly limit unsigned rationals to 2**31
, does not need to be validated. TIFF allows for rationals to be up to 2**32. If original file contained bigger (but still valid) value, then it has to be the same when Pillow saves it.
d0c78ef
to
8924054
Compare
On odoo.sh, in some circumstances, when uploading an image as attachment in odoo leads to a blank image thumbnail. The same image was successfully uploaded in the same odoo version on runbot instance. After some investigations, it appears that the issue comes from the python-pillow version used. A few bugs exists [0,1,2] in python-pillow 7.0.0 (packaged in ubuntu Focal) that are now fixed in version 8.1.0 [3,4,5] (packaged in Debian and specified in Odoo requirements.txt), that causes the `ImageOps.exif_transpose` method to fail. The present issue can be considered as a corner case as only images with particular exif tags cause the issue. The present fix is a simple workaround by first checking the presence of the orientation tag and using it, we can avoid a call to the `exif_transpose` method. opw-2369166 [0] python-pillow/Pillow#4346 [1] python-pillow/Pillow#3973 [2] python-pillow/Pillow#4238 [3] python-pillow/Pillow#4637 [4] python-pillow/Pillow#3980 [5] python-pillow/Pillow#4009
On odoo.sh, in some circumstances, when uploading an image as attachment in odoo leads to a blank image thumbnail. The same image was successfully uploaded in the same odoo version on runbot instance. After some investigations, it appears that the issue comes from the python-pillow version used. A few bugs exists [0,1,2] in python-pillow 7.0.0 (packaged in ubuntu Focal) that are now fixed in version 8.1.0 [3,4,5] (packaged in Debian and specified in Odoo requirements.txt), that causes the `ImageOps.exif_transpose` method to fail. The present issue can be considered as a corner case as only images with particular exif tags cause the issue. The present fix is a simple workaround by first checking the presence of the orientation tag and using it, we can avoid a call to the `exif_transpose` method. opw-2369166 [0] python-pillow/Pillow#4346 [1] python-pillow/Pillow#3973 [2] python-pillow/Pillow#4238 [3] python-pillow/Pillow#4637 [4] python-pillow/Pillow#3980 [5] python-pillow/Pillow#4009 closes #65584 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
On odoo.sh, in some circumstances, when uploading an image as attachment in odoo leads to a blank image thumbnail. The same image was successfully uploaded in the same odoo version on runbot instance. After some investigations, it appears that the issue comes from the python-pillow version used. A few bugs exists [0,1,2] in python-pillow 7.0.0 (packaged in ubuntu Focal) that are now fixed in version 8.1.0 [3,4,5] (packaged in Debian and specified in Odoo requirements.txt), that causes the `ImageOps.exif_transpose` method to fail. The present issue can be considered as a corner case as only images with particular exif tags cause the issue. The present fix is a simple workaround by first checking the presence of the orientation tag and using it, we can avoid a call to the `exif_transpose` method. opw-2369166 [0] python-pillow/Pillow#4346 [1] python-pillow/Pillow#3973 [2] python-pillow/Pillow#4238 [3] python-pillow/Pillow#4637 [4] python-pillow/Pillow#3980 [5] python-pillow/Pillow#4009 X-original-commit: b83c48d
On odoo.sh, in some circumstances, when uploading an image as attachment in odoo leads to a blank image thumbnail. The same image was successfully uploaded in the same odoo version on runbot instance. After some investigations, it appears that the issue comes from the python-pillow version used. A few bugs exists [0,1,2] in python-pillow 7.0.0 (packaged in ubuntu Focal) that are now fixed in version 8.1.0 [3,4,5] (packaged in Debian and specified in Odoo requirements.txt), that causes the `ImageOps.exif_transpose` method to fail. The present issue can be considered as a corner case as only images with particular exif tags cause the issue. The present fix is a simple workaround by first checking the presence of the orientation tag and using it, we can avoid a call to the `exif_transpose` method. opw-2369166 [0] python-pillow/Pillow#4346 [1] python-pillow/Pillow#3973 [2] python-pillow/Pillow#4238 [3] python-pillow/Pillow#4637 [4] python-pillow/Pillow#3980 [5] python-pillow/Pillow#4009 X-original-commit: b83c48d
On odoo.sh, in some circumstances, when uploading an image as attachment in odoo leads to a blank image thumbnail. The same image was successfully uploaded in the same odoo version on runbot instance. After some investigations, it appears that the issue comes from the python-pillow version used. A few bugs exists [0,1,2] in python-pillow 7.0.0 (packaged in ubuntu Focal) that are now fixed in version 8.1.0 [3,4,5] (packaged in Debian and specified in Odoo requirements.txt), that causes the `ImageOps.exif_transpose` method to fail. The present issue can be considered as a corner case as only images with particular exif tags cause the issue. The present fix is a simple workaround by first checking the presence of the orientation tag and using it, we can avoid a call to the `exif_transpose` method. opw-2369166 [0] python-pillow/Pillow#4346 [1] python-pillow/Pillow#3973 [2] python-pillow/Pillow#4238 [3] python-pillow/Pillow#4637 [4] python-pillow/Pillow#3980 [5] python-pillow/Pillow#4009 X-original-commit: b83c48d
On odoo.sh, in some circumstances, when uploading an image as attachment in odoo leads to a blank image thumbnail. The same image was successfully uploaded in the same odoo version on runbot instance. After some investigations, it appears that the issue comes from the python-pillow version used. A few bugs exists [0,1,2] in python-pillow 7.0.0 (packaged in ubuntu Focal) that are now fixed in version 8.1.0 [3,4,5] (packaged in Debian and specified in Odoo requirements.txt), that causes the `ImageOps.exif_transpose` method to fail. The present issue can be considered as a corner case as only images with particular exif tags cause the issue. The present fix is a simple workaround by first checking the presence of the orientation tag and using it, we can avoid a call to the `exif_transpose` method. opw-2369166 [0] python-pillow/Pillow#4346 [1] python-pillow/Pillow#3973 [2] python-pillow/Pillow#4238 [3] python-pillow/Pillow#4637 [4] python-pillow/Pillow#3980 [5] python-pillow/Pillow#4009 X-original-commit: b83c48d
Related: #3973.
Changes proposed in this pull request: