March 24, 20266 min read

Client-Side Image Processing with WebAssembly

How GifMash uses WebAssembly to run Gifsicle and other native image tools directly in the browser — no server uploads required.

wasmwebassemblyengineeringprivacy

The privacy problem with online image tools

Most "free online" GIF compression tools work by uploading your file to a server, processing it, and returning the result. This creates several problems: your files are transmitted over the internet, they're temporarily stored on someone else's infrastructure, and you have no control over what happens to them afterward.

GifMash takes a different approach: all processing happens in your browser, on your device. Files never leave your machine. This is possible because of WebAssembly (WASM).

What is WebAssembly?

WebAssembly is a binary instruction format designed to run near-native speed in web browsers. Code compiled to WASM runs in the same sandbox as JavaScript but can be significantly faster for compute-intensive tasks — and critically, it allows running code originally written for native platforms.

Gifsicle, the gold-standard GIF optimization tool written in C, was compiled to WASM by the gifsicle-wasm-browser package. GifMash loads this WASM module, passes your GIF file to it, and receives the optimized output — all without any network request.

How GifMash uses WASM

The processing pipeline for a typical compression looks like this:

  1. User selects a GIF file — it's read into an ArrayBuffer in the browser
  2. The WASM module is loaded (once, and cached by the browser for subsequent uses)
  3. The ArrayBuffer is passed to Gifsicle via the WASM interface
  4. Gifsicle applies the requested operations (color reduction, lossy compression, resize, etc.)
  5. The optimized GIF bytes are returned as a new ArrayBuffer
  6. A Blob URL is created from the buffer for download — no server involved

Performance in the browser vs native

WASM typically runs at 60–80% of native speed for compute-heavy code. For GIF processing, this means a 5 MB GIF might take 1–3 seconds in the browser vs sub-second on native. This is acceptable for interactive tools, and is improving as browser WASM engines mature.

For very large GIFs (20+ MB), processing can take 5–10 seconds. GifMash shows a progress bar during processing to keep users informed.

The gif.js approach for creation tools

Gifsicle excels at modifying existing GIFs. For creating GIFs from scratch (Video to GIF, GIF Maker, Add Text to GIF), GifMash uses gifenc — a fast, pure JavaScript GIF encoder with palette quantization that works entirely in the browser without WASM.

What this means for you

Your files never leave your browser — not stored, not logged, not analyzed. There's no upload/download round-trip, so processing starts immediately. Once the WASM module is cached, the tools even work offline. And since there are no servers to run, there are no server costs — GifMash stays free.

Try GifMash for free

All GifMash tools run in your browser using WebAssembly — your files never leave your device.

Try it free