libvips for the browser and Node.js, compiled to WebAssembly with Emscripten.
Programs that use
wasm-vips don't manipulate images directly, instead
they create pipelines of image processing operations building on a source
image. When the end of the pipe is connected to a destination, the whole
pipeline executes at once, streaming the image in parallel from source to
destination a section at a time. Because
wasm-vips is parallel, it's quick,
and because it doesn't need to keep entire images in memory, it's light.
Note: This library is still under early development. See: #1.
A browser that supports the SharedArrayBuffer API.
|version 74+||version 79+||version 79+|
npm install wasm-vips
vips.worker.js to be served from
the same directory.
wasm-vips uses the latest experimental features of WebAssembly,
you need to add these extra flags to run in Node.js.
node --experimental-wasm-threads --experimental-wasm-simd --experimental-wasm-bulk-memory demo.js
// Load an image from a filelet im = vipsImage;// Put im at position (100, 100) in a 3000 x 3000 pixel image,// make the other pixels in the image by mirroring im up / down /// left / right, see//im = im;// Multiply the green (middle) band by 2, leave the other two aloneim = im;// Make an image from an array constant, convolve with itconst mask = vipsImage;im = im;// Finally, write the result to a bufferconst outBuffer = im;