odoo/odoo#96307

Created by Bugfix, Nicolas Lempereur (nle)
Merged at 743ab6732140def3f5cfce15d72046aaa373ddd7

Statuses:

label
odoo-dev:14.0-base-opw-2897291-nle
head
bbdfdd21f0fd158091f58dbb7bc18e3514b43ad0
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
18.0
saas-18.1
saas-18.2
saas-18.3
saas-18.4
master #97083

[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