Edge-Detection-Wasm
This is a simple rust library that is compiled down to WebAssembly using wasm-pack
.
The exported function (detect
) takes in a pixel buffer in the form of a ClampedUint8Array
and outputs a new pixel buffer that has all the detected "edges" in that image highlighted
with a given color
Alot of this code was inspired by
https://github.com/PistonDevelopers/imageproc
🚴 Usage
; const canvas = document;const ctx = canvas; const imageData = ctx;const data = wasm;ctx;
🚴 Contributing
wasm-pack build
🛠️ Build with wasm-pack build
npm start
🛠️Start demo app with cd www && npm start
wasm-pack publish
🎁 Publish to NPM with wasm-pack publish
🏎 Speed
On my newish MBP, the detect
function completes in about 25ms. I'd like to get it under 20ms.
Size
- JavaScript ~ 987b (gzip)
- Wasm ~ 11kb (gzip)