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

feat: add support for webp images #622

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

Conversation

darshkpatel
Copy link

@darshkpatel darshkpatel commented Jun 8, 2024

Summary
This pull request introduces a new method to parse WEBP images and extract their dimensions. The implementation is based on the WEBP container specifications and currently supports the following WEBP specifications:

  • VP8
  • VP8L
  • VP8X

Details
The method reads and verifies the WEBP file header, then iterates through the file's chunks to extract the image dimensions. It performs necessary boundary checks to ensure the integrity of the data being read.

Specifications and References
WEBP Container Specification: Google Developers - RIFF Container
General WEBP Information: Google Developers - WEBP
Test Images: Images used for testing were sourced from Google Developers - WEBP Gallery

Fixes: #607
Fixes: #539
Fixes: #273
Fixes: #311

@darshkpatel darshkpatel requested a review from shuding as a code owner June 8, 2024 08:51
Copy link

vercel bot commented Jun 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
satori-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 22, 2024 4:08pm

@darshkpatel
Copy link
Author

darshkpatel commented Jun 22, 2024

Ready for a review! @shuding
Can you approve the workflow runs ?

@richtera
Copy link

This looks cool! I can help if needed. I have a use case which I needed it for.

@shuding
Copy link
Member

shuding commented Jul 4, 2024

The main problem here is that Satori only handles HTML/CSS → SVG, but the downstream solutions (vercel/og and Resvg.js) that render the SVG as an image don't support WebP inside the SVG yet.

This means that even if WebP is added here, it's still not possible to render the source to rasterized images (PNG, JPEG, etc).

Current blockers to get this landed:

@adamJLev
Copy link

good news, resvg merged their webp support!
RazrFalcon/resvg#747

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