WASM wrapper of mozjpeg, ready for the browser

Overview

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
You might also like...
The Bloat-Free Browser Game in Rust but in C and not in a Browser
The Bloat-Free Browser Game in Rust but in C and not in a Browser

rust-browser-game but native and rendered with SDL in C without the Browser The original idea of rust-browser-game is that the game.wasm module is com

Rslide - A web service that allows you to move through multiple html pages in the browser like a slide, even without focusing on the app console or the browser. Currently only supports Windows.

rslide rslide is a web service that allows you to move through multiple html pages in the browser like a slide, even without focusing on the app conso

V86 - x86 virtualization in your browser, recompiling x86 to wasm on the fly

v86 emulates an x86-compatible CPU and hardware. Machine code is translated to WebAssembly modules at runtime in order to achieve decent performance.

2D real-time mutliplayer game in a browser. Showcase of the usability of wasm-peer crate.
2D real-time mutliplayer game in a browser. Showcase of the usability of wasm-peer crate.

Footballers Description 2D real-time multiplayer game in a browser. Players divided in two teams play a football match on field with two goal posts. G

Realtime audio processing / synthesis using Rust/WASM in the browser.
Realtime audio processing / synthesis using Rust/WASM in the browser.

Rust Audio About This repo is my investigation into using Rust for creative audio coding on various platforms (e.g. desktop, web, etc.), but especiall

WASM runtime for Deku and Michelson-to-WASM compiler

Tuna This repository has two different projects, a plugable VM for running WASM contracts on Deku and a Michelson to WASM compiler which also has some

Distribute a wasm SPA as HTML by wrapping it as a polyglot "html+wasm+zip"

A packer that adds a webpage to WASM module, making it self-hosted! Motivation At the moment, Browsers can not execute WebAssembly as a native single

Easy-to-use wrapper for WebRTC DataChannels peer-to-peer connections written in Rust and compiling to WASM.

Easy-to-use wrapper for WebRTC DataChannels peer-to-peer connections written in Rust and compiling to WASM.

Rust native ready-to-use NLP pipelines and transformer-based models (BERT, DistilBERT, GPT2,...)

rust-bert Rust native Transformer-based models implementation. Port of Hugging Face's Transformers library, using the tch-rs crate and pre-processing

Xori is an automation-ready disassembly and static analysis library for PE32, 32+ and shellcode
Xori is an automation-ready disassembly and static analysis library for PE32, 32+ and shellcode

Xori - Custom disassembly framework Xori is an automation-ready disassembly and static analysis library that consumes shellcode or PE binaries and pro

A feature-rich, production-ready, general purpose 2D/3D game engine written in Rust with a scene editor.
A feature-rich, production-ready, general purpose 2D/3D game engine written in Rust with a scene editor.

A feature-rich, production-ready, general purpose 2D/3D game engine written in Rust with a scene editor.

A clean, custom-built modular kernel ready to boot on x86_64.
A clean, custom-built modular kernel ready to boot on x86_64.

Lateral is a work-in-progress multitasking monolithic kernel + OS meant as a fun summer project. It has recently expanded into more than I could imagi

Provision Mammoth-ready Minecraft clusters with ease!

Minecraft Server Provisioner Provision Mammoth-ready Minecraft clusters with ease! Overview Provisioner is a tool designed to make the creation of Mam

Xori is an automation-ready disassembly and static analysis library for PE32, 32+ and shellcode
Xori is an automation-ready disassembly and static analysis library for PE32, 32+ and shellcode

Xori - Custom disassembly framework Xori is an automation-ready disassembly and static analysis library that consumes shellcode or PE binaries and pro

This Intelligent Transportation Systems (ITS) MQTT client based on the JSon ETSI specification transcription provides a ready to connect project for the mobility

This Intelligent Transportation Systems (ITS) MQTT client based on the JSon ETSI specification transcription provides a ready to connect project for the mobility (connected and autonomous vehicles, road side units, vulnerable road users,...). Let's connect your device or application to our Intelligent Transport Systems (ITS) platform!

The most efficient, scalable, and fast production-ready serverless REST API backend which provides CRUD operations for a MongoDB collection

Optimal CRUD Mongo Goals of This Project This is meant to be the most efficient, scalable, and fast production-ready serverless REST API backend which

Wonnx - a GPU-accelerated ONNX inference run-time written 100% in Rust, ready for the web

Wonnx is a GPU-accelerated ONNX inference run-time written 100% in Rust, ready for the web. Supported Platforms (enabled by wgpu) API Windows Linux &

A fresh FRAME-based Substrate node, ready for hacking

A substrate-based chain that runs in a single node, but simulates the existence of a large set of validators and nominators.

Static Web Server - a very small and fast production-ready web server suitable to serve static web files or assets
Static Web Server - a very small and fast production-ready web server suitable to serve static web files or assets

Static Web Server (or SWS abbreviated) is a very small and fast production-ready web server suitable to serve static web files or assets.

Comments
  • Program terminated with exit(1) when call decode method

    Program terminated with exit(1) when call decode method

    here is the code snippet:

      async decode(data) {
        const input = new Uint8Array(data);
        console.log(input, input.length);
        console.log(this.Module._decode(input, input.length));
        console.log('decode', this.Module.decode);
      }
    

    image

    opened by daddybh 0
  • Raw image data input

    Raw image data input

    Currently the library can only take in JPEG image data and recompress it. It would be useful if it allowed to take binary RGB data as well (essentially, making the encode function public). I suppose there are some open questions about the data format/layout though, such as stride.

    opened by grigorig 0
Releases(2.0.1)
Owner
Tommaso
Tommaso
De-chained Ready-to-play ink! playground

DRink! Dechained Ready-to-play ink! playground drink.mp4 What is DRink? DRink! aims providing support for ink! developers. It comes in two parts: drin

Cardinal 9 Jun 23, 2023
A fresh FRAME-based Substrate node, ready for hacking

Substrate Node Template A fresh FRAME-based Substrate node, ready for hacking ?? Getting Started Follow the steps below to get started with the Node T

Web 3 | Mobile | Blockchain Full Stack Engineer 6 Jun 23, 2023
reth-indexer reads directly from the reth db and indexes the data into a postgres database all decoded with a simple config file and no extra setup alongside exposing a API ready to query the data.

reth-indexer reth-indexer reads directly from the reth db and indexes the data into a postgres database all decoded with a simple config file and no e

Josh Stevens 306 Jul 12, 2023
🎙️ Catalyst Voices provides a unified experience and platform including production-ready liquid democracy

??️ Catalyst Voices provides a unified experience and platform including production-ready liquid democracy, meaningful collaboration opportunities & data-driven context for better onboarding & decisions.

Input Output 6 Oct 11, 2023
WebAssembly wrapper of the rage encryption library

rage-wasm: WebAssembly wrapper of rage rage is a simple, modern, and secure file encryption tool, using the age format. It features small explicit key

Kan-Ru Chen 35 Dec 16, 2022
clang-format wrapper for rust

clang-format-rs A basic clang-format Rust wrapper. This allows for formatting a given input using clang-format from the system. use clang_format::{cla

KDAB 4 Sep 24, 2022
Rust NACL Wrapper API

Rust NACL Wrapper API NaCl (pronounced "salt") is a new easy-to-use high-speed software library for network communication, encryption, decryption, sig

Júlio César de Brito Gardona 1 Jan 19, 2022
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
A Wasm component optimizer (mostly a wrapper around wasm-opt)

component-opt An optimizer for Wasm Components Current Status This project currently only offers one optimization and does not allow it to be configur

Robin Brown 6 Mar 4, 2024
rust-browser-game but native and rendered with ncurses in C without the Browser

Spin-off of rust-browser-game-but-sdl but with ncurses Nothing much to say. Just see rust-browser-game-but-sdl and rust-browser-game. Quick Start $ ma

Tsoding 8 Apr 21, 2022