The converted WebP images in the /var/As you convert more images, you may see variations in conversion rates related to these factors. rw-r-r- 1 sammy sammy 60K Feb 18 16:42 logo.webp Output-rw-r-r- 1 sammy sammy 116K logo.png ls -lh image1.jpg image1.webp image2.jpg image2.webp.The -l option will show the long listing format, which includes the size of the file, and the -h option will make sure that ls prints human readable sizes: Next, inspect the size of the JPEG and WebP images using the ls command. Setting the quality factor -q to 100 retains 100% of the image quality if not specified, the default value is 75. Since you are still in the /var/and image2.jpg to image2.webp: The -o option specifies the path to the WebP file. The general syntax of the command looks like this: In this step, you will convert JPEG and PNG images to the. Step 2 - Compressing Image Files with cwebp With the test images in place, and the Apache web server, mod_rewrite, and cwebp installed, you are ready to move on to converting images. Most of your work in the next step will be in the /var/www/html/webp directory, which you can move to by typing: Note: These images are available for use and redistribution under the Creative Commons Attribution-ShareAlike license and the Public Domain Dedication. wget -c "" -O /var/www/html/webp/logo.png.wget -c "" -O /var/www/html/webp/image2.jpg.wget -c "" -O /var/www/html/webp/image1.jpg.Next, download the test images using the following commands: This tool is installed by default on Ubuntu 16.04 if you are using CentOS 7, you can install it by typing: To test commands, you can download free JPEG and PNG images using wget. To create a new images directory called webp in the Apache web root (located by default at /var/www/html) type:Ĭhange the ownership of this directory to your non-root user sammy: On Ubuntu 16.04, you can install cwebp, a utility that compresses images to the. In this section, we will install software to convert images and create a directory with images as a testing measure. Step 1 - Installing cwebp and Preparing the Images Directory On CentOS 7 mod_rewrite is installed and activated by default. If you are using Ubuntu, you can follow our guide on How To Rewrite URLs with mod_rewrite for Apache on Ubuntu 16.04. Be sure to adjust your firewall settings to allow HTTP and HTTPS traffic. If you are using CentOS, then you should follow step one of How To Install Linux, Apache, MySQL, PHP (LAMP) stack On CentOS 7. If you are using Ubuntu, you can follow step one of How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 16.04. If you would like to use CentOS, you can set up a CentOS 7 server with our Initial Server Setup with CentOS 7 tutorial.Īpache installed on your server. To set up an Ubuntu 16.04 server, you can follow our Ubuntu 16.04 initial server setup guide. To follow this tutorial you will need:Ī server set up with a non-root sudo user. Working with WebP images does not require a particular distribution, but we will demonstrate how to work with relevant software on Ubuntu 16.04 and CentOS 7. Finally, you’ll explore two ways to serve WebP images to your visitors. In this tutorial, you will use the command-line tool cwebp to convert images to WebP format, creating scripts that will watch and convert images in a specific directory. If your application or website is experiencing performance issues or increased traffic, converting your images may help optimize page performance. Using WebP images can lead to sizeable increases in page speed. Its main advantage over other image formats used on the web is its much smaller file size, which makes web pages load faster and reduces bandwidth usage. The WebP format supports both lossy and lossless image compression, including animation. There are also plans for implementing WebP in Firefox. Both Google Chrome and Opera support the WebP format natively, and since these browsers account for about 74% of web traffic, users can access websites faster if these sites use WebP images. Since then, the number of websites and mobile applications using the WebP format has grown at a fast pace. WebP is an open image format developed by Google in 2010 based on the VP8 video format. The author selected the Apache Software Foundation to receive a donation as part of the Write for DOnations program.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |