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

Use ImageFileDirectory_v2 in Image.Exif #4637

Merged
merged 1 commit into from Jun 10, 2020
Merged

Conversation

radarhere
Copy link
Member

The Image.Exif class currently uses the legacy ImageFileDirectory_v1. This PR changes it to use ImageFileDirectory_v2.

Aside from the good practice of moving away from a legacy class, it also changes RATIONALs to be read as IFDRationals, instead of a tuple with (numerator, denominator).

A warning when saving tags 282 and 283 has been reported here and here, that the tags had too many entries: 2, expected 1. This PR means that only one value, the IFDRational, will be attempted to be saved, instead of two values, a tuple of the numerator and the denominator.

@radarhere radarhere added the Exif label May 22, 2020
@radarhere radarhere changed the title Changed to ImageFileDirectory_v2 Use ImageFileDirectory_v2 in Image.Exif May 22, 2020
@hugovk hugovk merged commit 794e9f0 into python-pillow:master Jun 10, 2020
@radarhere radarhere deleted the v2 branch June 10, 2020 05:51
d-fence added a commit to odoo-dev/odoo that referenced this pull request Feb 5, 2021
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
robodoo pushed a commit to odoo/odoo that referenced this pull request Feb 5, 2021
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>
fw-bot pushed a commit to odoo-dev/odoo that referenced this pull request Feb 5, 2021
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
fw-bot pushed a commit to odoo-dev/odoo that referenced this pull request Feb 5, 2021
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
fw-bot pushed a commit to odoo-dev/odoo that referenced this pull request Feb 5, 2021
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
fw-bot pushed a commit to odoo-dev/odoo that referenced this pull request Feb 5, 2021
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants