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

Updated error message when saving WebP with invalid width or height #8322

Merged
merged 5 commits into from
Aug 24, 2024

Conversation

radarhere
Copy link
Member

Resolves #8321

There is a limit on the size of WebP images.

https://developers.google.com/speed/webp/faq

The maximum pixel dimensions of a WebP image is 16383 x 16383.

When that limit is hit, this PR changes the error message from
"encoding error 5"
to
"encoding error 5: Image size exceeds WebP limit"

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth mentioning what the limit is? Or leave it out in case it might change?

@radarhere
Copy link
Member Author

I've updated the message to "encoding error 5: Image size exceeds WebP limit of 16383", using WEBP_MAX_DIMENSION so that if WebP does change the value, the message will also update.

src/_webp.c Outdated Show resolved Hide resolved
Tests/test_file_webp.py Outdated Show resolved Hide resolved
radarhere and others added 2 commits August 24, 2024 21:26
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
@radarhere radarhere merged commit dcd77b5 into python-pillow:main Aug 24, 2024
52 checks passed
@radarhere radarhere deleted the webp branch August 24, 2024 13:12
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 this pull request may close these issues.

ValueError: encoding error 5 during WEBP encoding should be replaced with something more informative
2 participants