After building PicoWebP in PHP, I ported the encoder to TypeScript. The same work can now run in Node.js and in a browser, without a native binary or a WebAssembly module to ship alongside it.
PicoWebPJS includes its own PNG, baseline JPEG and BMP readers, plus the encoder that writes the VP8 WebP bitstream. The published package has zero runtime dependencies. Give it image bytes or raw RGB pixels and it handles the conversion in JavaScript.
That makes it useful for browser tools that process images on the user's device, or Node.js applications where native image tooling would complicate deployment. There is a Web Worker example for keeping the page responsive, a CLI for file conversion, and both ESM and CommonJS builds.
The less visible details matter too. Transparency is compressed losslessly, embedded ICC colour profiles are carried through, and files that are already WebP are skipped based on their contents. For longer Node.js jobs, the encoder can save its state and resume in another process.
There are limits. Colour compression is lossy, progressive JPEGs need an additional decoder, and native encoders are generally faster. Encoding is synchronous, so browser applications should move substantial work into a worker.
PicoWebPJS is available on npm under the MIT licence. The Node.js API and CLI require Node 18 or newer.
Installation
npm install picowebpjs