
After compression, WebP pictures are smaller than other image file formats, yet they retain the quality. WebP prosĬompression is WebP’s most prominent selling factor. PNG or GIF to WebP conversion supports alpha transparency and animation, respectively. On average, the WebP file is 25%-34% smaller than the same JPEG file at the same image quality. Ultimately, the reduced image size allows a faster website loading. Lossy image compression results in even smaller files but reduced image quality. Lossless compression provides the same image quality but a smaller file size. $ for f in *.webp do dwebp $f -o $f.WebP is a modern image format with superior lossless or lossy compression web images. If you have a lot of WebP photos to convert, you can use a Bash for loop to bulk convert hundreds or thousands of WebP photos at once. $ dwebp image.webp -o image.pngĮxample 2. All you need to do is specify the name of your WebP file, the -o (output) option, and the name of your new PNG file. Use the dwebp tool to decode WebP images into PNG. If you have PNG files scattered throughout subdirectories, you can use the find command to traverse subdirectories and convert every. $ for f in *.png do cwebp -q 85 -mt $f -o $f.webp doneĮxample 5. If you have a lot of PNG photos to convert, you can use a Bash for loop to bulk convert hundreds or thousands of PNG photos to WebP at once. $ cwebp -q 85 -mt image.png -o image.webpĮxample 4. It’s also a good idea to use the -mt (multi-threading) option, which will better utilize your system’s CPU and convert the images more quickly. $ cwebp -q 85 image.png -o image.webpĮxample 3. A quality level of 80-85% generally gives acceptable results. This can help you achieve a lower file size while sacrificing some quality in your image. Use the -q option to control the quality level. $ cwebp image.png -o image.webpĮxample 2. All you need to do is specify the name of your PNG file, the -o (output) option, and the name of your new WebP file. Use the cwebp tool to encode PNG images into WebP. Ubuntu, Debian, and Linux Mint: $ sudo apt install webpĪrch Linux and Manjaro: $ sudo pacman -S libwebpĮxample 1. You can install these tools with your Linux distro’s package manager by using the appropriate command below. Conversely, cwebp is used to convert PNG images into WebP files. The dwebp command is used to convert photos from WebP to PNG. You’ll also see how to convert images into WebP, in case you plan to upload photos somewhere and want the smaller file size for your web visitors. In this tutorial, you’ll see how to convert WebP images to PNG with Linux commands. Outside of web hosting, the PNG image format is much more popular and better suited to archiving. This makes it an ideal format for images on websites, just as its name would imply. The WebP image format is great at compressing photos to incredibly small file sizes.
