A browser can run a mature image encoder without sending the image to a server. WebAssembly makes that practical by letting developers compile existing native libraries for the browser. The interesting engineering decisions come afterward: how bytes reach the encoder, which thread does the work, and how much memory remains available.
What runs, and where
WebAssembly, usually shortened to Wasm, is a portable binary compilation target. Languages including C, C++, and Rust can produce modules that a browser engine validates, compiles, and executes. JavaScript typically handles the surrounding application: file selection, interface updates, network requests, and downloads. Wasm handles a bounded piece of computation. MDN's concepts guide explains this relationship and the module's main building blocks.
A module exposes functions through exports and receives capabilities through imports. Its linear memory is a contiguous, byte-addressable region.…