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

WebP file size increased by 20-60%, compared to Pillow 7.1.2 #4786

Closed
pix666 opened this issue Jul 15, 2020 · 2 comments · Fixed by #5450
Closed

WebP file size increased by 20-60%, compared to Pillow 7.1.2 #4786

pix666 opened this issue Jul 15, 2020 · 2 comments · Fixed by #5450
Labels

Comments

@pix666
Copy link

pix666 commented Jul 15, 2020

What did you do?

Load the image linked below, convert it to WebP.

What did you expect to happen?

Same file size as with Pillow 7.1.2 (± 5%)

What actually happened?

File size increased by almost 50%, compared to Pillow 7.1.2.

File Size
Source (jpg) 214 779
Pillow 7.1.2 (webp) 108 450
Pillow 7.2.0 (webp) 159 964

What are your OS, Python and Pillow versions?

  • OS: Ubuntu 20.04
  • Python: 3.8.2
  • Pillow: 7.2.0
from PIL import Image
source = Image.open('source.jpg')
source.save('dest.webp', quality=80)

source

@radarhere
Copy link
Member

Testing, I find this is the result of #4547

@radarhere
Copy link
Member

Looking at the webp source code, the default 'method' value is 4 - https://chromium.googlesource.com/webm/libwebp/+/refs/heads/master/src/enc/config_enc.c#34

If I pass in method=4 to the save method -

from PIL import Image
source = Image.open('source.jpg')
source.save('dest.webp', quality=80, method=4)

Then I get the same file size as before the change.

So the different because we changed the default behaviour. I've created #5450 to resolve this by changing our default to 4 as well.

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 a pull request may close this issue.

2 participants