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

Use Capsule for WEBP saving #8386

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

homm
Copy link
Member

@homm homm commented Sep 16, 2024

Adoption of #8341 ideas

Improvements

  • Doesn't create extra image copy (.tobytes("raw", rawmode))
  • Uses the same more appropriate API .has_transparency_data for save and save_all.
  • Supports saving RGBX mode without conversion
  • Adds ImagingSectionEnter/Leave for WebPAnimEncoder

Also:
remove _VALID_WEBP_MODES and _VALID_WEBP_LEGACY_MODES consts
RGBX is not faster RGB since demands more bandwidth
Do not convert to str paths in tests
@homm homm added the WebP label Sep 16, 2024
Tests/test_file_webp.py Outdated Show resolved Hide resolved
@Yay295
Copy link
Contributor

Yay295 commented Sep 16, 2024

You're essentially using _VALID_WEBP_MODES in two locations, but you removed that constant. I assume you inlined them when _VALID_WEBP_MODES and _VALID_WEBP_LEGACY_MODES were each only used in one place, but it seems like _VALID_WEBP_MODES could be kept. Also it could just be a Set instead of a Dict with True values.

@homm
Copy link
Member Author

homm commented Sep 17, 2024

@Yay295 I've removed this constants primary since it's mistyping. Now I'm added separate _convert_frame routine for this.

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.

3 participants