![]() It is always difficult to convert all the JPEG and PNG images into a directory manually. Now, Let’s see how to do that in bulk! Convert all the JPEG and PNG Images in a Directory So, this is how you can convert a single jpg or png file to webp format. $ sudo cwebp -lossless tree.png -o tree.webp To convert the PNG file for testing, execute the following command. We mainly use this option to convert the PNG file to maintain its quality. To retain the complete data of the image during the compression, use the ‘-lossless’ option in the place of -q. rw-r-r- 1 sshusr sshusr 3.9M Jan 23 16:46 chinawall.webp rw-r-r- 1 sshusr sshusr 7.4M Jan 18 23:36 chinawall.jpg ![]() $ sudo ls -lh chinawall.jpg chinawall.webp Once converted, you can check the drastic size decrease of the file using the ls command. The -q in the above given command specifies the image quality that needs to get retained after the conversion. Since we are already in the ‘/var/-o chinawall.webp The -o option species the path where you want to save the converted WebP file. The general syntax of the cwebp command to convert the image format is: $ cwebp image.jpg -o image.webp We can convert the PNG and JPEG images to the “.webp” format using the command-line utility of WebP. $ sudo cd /var/www/html/webp Compress Image Files into WebP Format With cwebp Then, switch to the ‘/var/www/html/webp’ directory. $ sudo wget -c "" -O /var/www/html/webp/tree.png $ sudo wget -c "" -O /var/www/html/webp/chinawall.jpg Execute the following commands to download the test images using wget. The wget utility is in-built in the Ubuntu operating system so you don’t have to install it. To test the cwebp command-line utility, we can download free PNG and JPEG images using wget. Then, change the ownership of the above-created directory to the ssh user ‘sshusr’. $ sudo apt install webpĪfter that, create a new image directory named ‘webp’ in the Apache root directory. $ sudo apt updateĮxecute the following command to install WebP on your server. Now, update the repositories by executing the following command. Log in to the server as an ssh user with sudo privileges. To install the cwebp command-line utility on your Ubuntu server, follow these steps: The cwebp is a command-line utility that helps compress images into the ‘.webp’ format. And then we will create a directory with images for testing. Steps to Install cwebp and Prepare the Image Directoryįirst, we need to install the software that helps us convert the images. To know more about how to install a LAMP stack on Ubuntu, refer to. A server installed with the LAMP stack.In this knowledge base, you will learn the steps to install the command-line WebP tool (cwebp) and the steps to convert all the images to WebP format. For the same, we can convert all formats of the website images into WebP format. If your website is experiencing any issues with its performance or increased traffic, then it is essential to optimize the page performance. ![]() The smaller file size of WebP images makes the website load faster which is extremely important and also reduces the bandwidth usage. The advantage of using WebP as the image format is its smaller file size. This format supports both lossless and lossy image compressions, such as animations. Natively, Google Chrome and Opera are the two browsers that support the WebP format. Google developed it in 2010, and since then, most of the websites and mobile applications use this image format to establish at a fast pace. ![]() WebP is a free, open-source image format based on the VP8 video format.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |