Documentation

Credits

@napi-rs/image is a thin, ergonomic binding layer. Nearly all the real work — decoding, encoding, resampling, optimization — is done by these excellent Rust crates and the C/C++ libraries behind them. Please consider starring and supporting them.

Project Role here
image (image-rs) Core decoding & encoding (PNG, JPEG, WebP, BMP, ICO, TIFF, PNM, TGA, Farbfeld) and the geometric/color transforms (resize, crop, blur, grayscale, …).
oxipng Lossless PNG optimization — losslessCompressPng.
pngQuantize (built-in) Lossy PNG palette quantization — pngQuantize. In-house MIT implementation (median-cut + k-means + Floyd-Steinberg).
mozjpeg (mozjpeg-sys) JPEG encoding and re-compression — compressJpeg.
libwebp (libwebp-sys) WebP encode & decode — webp, webpLossless.
libavif + aom AVIF encode & decode — avif.
resvg SVG rasterization — Transformer.fromSvg.
fast_image_resize SIMD-accelerated resizing — fastResize.
rexif EXIF metadata parsing — metadata, EXIF-aware rotate.

napi-rs

The Node.js native addon and the cross-origin-isolated WebAssembly build are both produced by napi-rs — the framework for building pre-compiled Node.js add-ons in Rust. The browser build additionally relies on emnapi, which implements the Node-API on top of Emscripten/WASI so the same Rust code runs in the browser.

License

@napi-rs/image is MIT licensed. The bundled codecs retain their own upstream licenses.


Built and maintained by LongYinan. If this library saves you time, consider sponsoring.