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

Encode WebP via WASM #12843

Open
bep opened this issue Sep 9, 2024 · 2 comments
Open

Encode WebP via WASM #12843

bep opened this issue Sep 9, 2024 · 2 comments
Assignees
Labels
Milestone

Comments

@bep
Copy link
Member

bep commented Sep 9, 2024

See https://github.com/gen2brain/webp

Now, if we then somehow could get rid of libsass we will have a CGO free build (no need for extended), which would be a massive win. We would want to continue producing theextended archives, of course, to make sure we 1. Avoid breaking builds in the wild (e.g. Netlify) and 2. In case we need to re-introduce it in the future.

@bep bep added the Proposal label Sep 9, 2024
@bep bep added this to the Unscheduled milestone Sep 9, 2024
@bep bep self-assigned this Sep 9, 2024
@bep bep pinned this issue Sep 9, 2024
@gen2brain
Copy link

Just a few notes. Currently, there is no way to initialize a Wazero runtime, it will do it lazy if it is not initialized. The Wazero docs clearly state that panic can happen when concurrently initializing the same runtime, and my usage is such that I don't want to do that unconditionally in init() (i.e. I use it for the image.Decode and without concurrent code).
There is sync.OnceFunc is in the code but it is not enough. I have never seen it for Webp because it works really fast, but for other libraries I have (avif, jpegxl, etc.) that is the case. I will add Initialize() when I find time so the user can do it manually.

The other issue is that library will first try to use a dynamic/shared library (if found) via purego. Due to the way purego works (at least on Linux), the binary will always link to libc, even with CGO_ENABLED=0, so there are again issues if you compile on e.g. recent glibc and try to use it on some older system. You can disable purego with the nodynamic build tag, then only WASM will be used.

@cmahnke
Copy link

cmahnke commented Sep 10, 2024

That's a great idea, since it would also allow (in the long run, since there certainly still be need sort some sort of wrapper / mapper) for more image formats available via WASM, like libultrahdr-wasm for #12781

@bep bep unpinned this issue Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants