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

[FW][FIX] base: fix autoresize and exclude gif #96859

Conversation

fw-bot
Copy link
Contributor

@fw-bot fw-bot commented Jul 27, 2022

Odoo may resize attachment image with side larger than 1920 pixels.

But for animated gifs, this resizement seems to in general increase size
file which is not what we want (in some case making it grow from 3MB to
60 MB).

So with this change, we only resize and optimize images that are not
gifs.

Reasoning: pillow doesn't seem to resize GIF (and seems to only increase
their size, especially animated GIF, because each frame is not
optimized) so we should just not touch them.

Note:

  • currently tiff were not resized (because of a mimetype typo)
  • currently image dimensions were not resized (from our test, resizing
    on the dimension does not change the size much, quality is most
    important).

both of these issue have been solved in this commit.

opw-2897291

Note: In the ticket case, a 4MB gif would grow to 60 MB. Here is an example of a 300 KB gif that is getting saved as 3 MB:

bignyan

Forward-Port-Of: #96307

@robodoo
Copy link
Contributor

robodoo commented Jul 27, 2022

Pull request status dashboard

@fw-bot
Copy link
Contributor Author

fw-bot commented Jul 27, 2022

Ping @nle-odoo cherrypicking of pull request #96307 failed.

stderr:

13:43:08.193216 git.c:344               trace: built-in: git cherry-pick bbdfdd21f0fd158091f58dbb7bc18e3514b43ad0
error: could not apply bbdfdd21f0f... [FIX] base: fix autoresize and exclude gif
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
----------
status:

Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?).

In the former case, you may want to edit this PR message as well.

@robodoo robodoo added conflict There was an error while creating this forward-port PR forwardport This PR was created by @fw-bot labels Jul 27, 2022
@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Jul 27, 2022
Odoo may resize attachment image with side larger than 1920 pixels.

But for animated gifs, this resizement seems to in general increase size
file which is not what we want (in some case making it grow from 3MB to
60 MB).

So with this change, we only resize and optimize images that are not
gifs.

Reasoning: pillow doesn't seem to resize GIF (and seems to only increase
their size, especially animated GIF, because each frame is not
optimized) so we should just not touch them.

Note:

- currently tiff were not resized (because of a mimetype typo)
- currently image dimensions were not resized (from our test, resizing
  on the dimension does not change the size much, quality is most
  important).

both of these issue have been solved in this commit.

opw-2897291

X-original-commit: 743ab67
@nle-odoo nle-odoo force-pushed the saas-15.2-14.0-base-opw-2897291-nle-oRpf-fw branch from 486a8c2 to ab04a8e Compare July 28, 2022 13:38
@C3POdoo C3POdoo requested review from a team July 28, 2022 13:45
@nle-odoo
Copy link
Contributor

robodoo r+

robodoo pushed a commit that referenced this pull request Jul 29, 2022
Odoo may resize attachment image with side larger than 1920 pixels.

But for animated gifs, this resizement seems to in general increase size
file which is not what we want (in some case making it grow from 3MB to
60 MB).

So with this change, we only resize and optimize images that are not
gifs.

Reasoning: pillow doesn't seem to resize GIF (and seems to only increase
their size, especially animated GIF, because each frame is not
optimized) so we should just not touch them.

Note:

- currently tiff were not resized (because of a mimetype typo)
- currently image dimensions were not resized (from our test, resizing
  on the dimension does not change the size much, quality is most
  important).

both of these issue have been solved in this commit.

opw-2897291

closes #96859

X-original-commit: 743ab67
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
@robodoo robodoo closed this Jul 29, 2022
@robodoo robodoo temporarily deployed to merge July 29, 2022 11:07 Inactive
@fw-bot fw-bot deleted the saas-15.2-14.0-base-opw-2897291-nle-oRpf-fw branch August 12, 2022 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conflict There was an error while creating this forward-port PR forwardport This PR was created by @fw-bot OE the report is linked to a support ticket (opw-...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants