-
Notifications
You must be signed in to change notification settings - Fork 328
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
Implementing in WebAssembly #3
Comments
The simplest way would be to use Emscripten for that: https://emscripten.org/ It helps that no machine assembly / SIMD instructions are used in qoi, which is usually the primary pain when compiling into WebAssembly. |
I would assume I would have to pass in the whole image file into the "wasmed" qoi script as opposed to streaming the file. Again, forgive my ignorance if these are simple questions. |
That sounds right. I recommend following this guide: https://developer.mozilla.org/en-US/docs/WebAssembly/existing_C_to_wasm It shows how to compile libwebp into WebAssembly and get it working in the browser, so it should be very similar in the qoi case, just simpler. |
following this totorial https://emscripten.org/docs/getting_started/Tutorial.html error (looks like i neeed to read readme carefully) Anyway, as mentioned fs related logic shold be different for wasm, it could be array of pixels as input + dimensions |
Rust supports compiling directly to WebAssembly. It should be fairly straight forward to take the Rust clone and create a JavaScript wrapper as an alternative solution. |
This is also on my bucket list. If i find the time today or tomorrow, i can try creating a "wasm polyfill" for QOI support based on the Zig impl |
i think this is suitable as an exercise for the readers to handwrite wasm. |
This may be a dumb and obvious question but how would you implement this in WebAssembly so you can use it with things like Node Serverless Functions and Edge Workers?
The text was updated successfully, but these errors were encountered: