odoo/odoo#97065

Created by fw-bot
Merged at 1d0e5da8259357affdd38717bc762548406ce988

Statuses:

label
odoo-dev:saas-15.3-14.0-base-opw-2897291-nle-4Flq-fw
head
a359bb074bf7e3927925b5fb78eafecd5b5db8e6
merged
3 years ago by Bugfix, Nicolas Lempereur (nle)
odoo/odoo
14.0 #96307
15.0 #96848
saas-15.2 #96859
saas-15.3 #97065
saas-15.4 #97072
16.0
17.0
saas-17.4
18.0
saas-18.1
saas-18.2
saas-18.3
master #97083

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

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: #96859
Forward-Port-Of: #96307