Squoosh is an image compression web app that reduces image sizes through numerous formats.
Squoosh can be used via API or CLI to compress many images at once.
Squoosh CLI is an experimental way to run all the codecs from the Squoosh web app via command line using WebAssembly.
The Squoosh CLI uses a worker pool to parallelize processing images. This way you can apply the same codec to many images at once.
Note: Squoosh CLI is currently not the fastest image compression tool in town and doesn’t aim to be. It is, however, fast enough to compress many images sufficiently quick at once.
The Squoosh CLI can be used straight from the command line without installing using npx:
$ npx @squoosh/cli <options...>
You can also install the Squoosh CLI:
$ npm i -g @squoosh/cli
npx @squoosh/cli --mozjpeg auto source-directory/ace.jpg -d output-directory/
This example will take a jpg file input, apply compression, and output a jpg file to the specified directory.