odoo/odoo#96848

Created by fw-bot
Merged at 862aca748186902bec9dfa80d7af1b35bf828e44

Statuses:

label
odoo-dev:15.0-14.0-base-opw-2897291-nle-R_2a-fw
head
39a9024ac28761552aee305774235a9074d74bd2
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: #96307