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

pywebp doesn't expose "target_size" parameter to limit the maximum size of the resulting file. #64

Closed
john-parton opened this issue Apr 30, 2024 · 1 comment · Fixed by #65

Comments

@john-parton
Copy link

The webp API supports saving with a "target_size" parameter to limit the maximum size of the resulting file.

int target_size;        // if non-zero, set the desired target size in bytes.
                        // Takes precedence over the 'compression' parameter.

https://developers.google.com/speed/webp/docs/api

As far as I can tell, this isn't exposed in pywebp.

This would be a useful feature for me, because I'm using CloudFlare images with has a hard 10MB cap on image size. It would be nice to just set the file size to just under 10MB and remove guesswork about appropriate Q values.

See also:

@anibali
Copy link
Owner

anibali commented May 3, 2024

I just had a go at implementing this in #64. Would that PR meet your needs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants