Skip to content

WASM wrapper of mozjpeg, ready for the browser

Notifications You must be signed in to change notification settings

rustbunker/mozjpeg-wasm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mozjpeg-wasm

This library wraps mozjpeg-sys and exposes a few functions to perform decoding, encoding and simple transformation on JPEG images using mozjpeg.

Everything is compiled to WebAssembly and bundled in an NPM package which can be used directly in a browser.

Install

$ npm i @neslinesli93/mozjpeg-wasm

Usage

The library contains two files:

  • mozjpeg-wasm.wasm: it's the WebAssembly bundle that exposes all the functions to perform operations on JPEG images
  • mozjpeg-wasm.js: it exposes JS glue code that can be used to call the functions defined in the WebAssembly module

An example on the usage can be seen inside the JPEG.rocks repo

Build from source

Prerequisites:

  1. Emscripten (>= 1.39.20)
  2. Rust (>= 1.48.0)
  3. Rust target wasm32-unknown-emscripten

Then you can launch this cargo command:

$ cargo build --target wasm32-unknown-emscripten

About

WASM wrapper of mozjpeg, ready for the browser

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%