To compress and compare images with different codecs right in your browser there’s squoosh.app that you can use.
Squoosh CLI is an experimental way to run all the codecs you know from the Squoosh web app on your 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.
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.
Run it using npx, or install it globally:
npx @squoosh/cli <options...>
npm i -g @squoosh/cli squoosh-cli <options...>