Last updated on October 18, 2024
To losslessly convert a PNG image to a WebP image on GNU/Linux, run the following command:
cwebp -z 9 input.png -o output.webp
9 indicates the best effort to compress the image, resulting in the smallest image size. You can replace 9 with a smaller number if you prefer a less aggressive compression effort.
If you haven't installed cwebp
yet, it is available in the webp package in Debian and Ubuntu.