A a browser-ready image filter app by compiling Rust to WebAssembly (WASM). Applying a grayscale filter to an image using the image crate in Rust, then expose the function to JavaScript via wasm-bindgen.
wasm-bindgen bridges Rust and JS
image crate applies transformations
Image I/O via Uint8Array <-> &[u8]
JS handles DOM/UI, Rust handles compute
Install wasm-pack:
cargo install wasm-pack
wasm-pack new wasm_filter
cd wasm_filter
wasm-pack build --target web
This outputs pkg/ with wasm and JS bindings.
Use a local static server like basic-http-server:
Open http://localhost:4000 and test your image filter 🎨