Using Webp to convert images to the .webp Format
WebP is an image format that provides lossless and lossy compression of images for use on the web. Linux Mint comes with an easy-to-use command-line software to convert images to .webp format.
First check the Software Manager to ascertain that Webp is installed. In the search box of software manager enter "webp". Webp will appear towards the end of the list. If it is not marked as installed, then click the install button.
Go the directory where the images are located.
Right click on the directory name and select "Open in Terminal" option.
Installation of WebP provides three command line utilities:
- cwebp: For compression of an image file to the WebP format.
- dwebp: For decompression of an image file to a PNG, PAM, PPM or PGM formats.
- vwebp: For decompression and display of an image file.
To convert an image, enter the following commmand in a terminal window:
cwebp Input_filename.jpg -o Output_filename.webp
To convert and and resize an image, in the terminal window enter the following commmand:
cwebp -resize 180 0 Input_filename.jpg -o Output_filename.webp
This command will resize the width of the image to 180 pixels. The zero after 180 specifies automatic determination of the image height maintaining image aspect ratio.