WebP is an image file format from Google that provides lossy compression (like JPEG) as well as transparency (like PNG) but can provide better compression than either JPEG or PNG. Lossy WebP images are supported in Android 4.0 (API level 14) and higher, and lossless and transparent WebP images are supported in Android 4.3 (API level 18) and higher. This page shows how to convert images to WebP format and how to convert WebP images to PNG format. Webp Converter


Note: Because support for lossless and transparent WebP images is only available in Android 4.3 and higher, your project must declare a minSdkVersion of 18 or higher to create lossless or transparent WebP images using Android Studio.


For more information about the WebP image format, see the WebP site. For more information about selecting the correct image format to improve download speed, see Reduce image download sizes.



Convert images to WebP

Android Studio can convert PNG, JPG, BMP, or static GIF images to WebP format. You can convert individual images or folders of images. To convert an image or folder of images, proceed as follows:


Right click on an image file or a folder containing a number of images files, and then click Convert to WebP.

The Converting Images to WebP dialog opens. The default settings depend on the minSdkVersion setting for the current module.


Figure 1. The Converting Images to WebP dialog


Select either lossy or lossless encoding. Lossless encoding is only available if your minSdkVersion is set to 18 or higher. If you select lossy encoding, set the encoding quality, and choose whether or not to view a preview of each converted image before saving.


You can also choose to skip converting any files where the encoded version would be larger than the original, or any files with transparency or an alpha channel. Because Android Studio only allows you to create transparent WebP images if your minSdkVersion is set to 18 or higher, the Skip images with transparency/alpha channel checkbox is automatically selected if your minSdkVersion is lower than 18.


Note: 9-patch files cannot be converted to WebP images. The converter tool always automatically skips 9-patch images.


Click OK to begin the conversion. If you are converting more than one image, the conversion is a single step, and can be undone to revert all the images you converted at once.


If you selected lossless conversion above, the conversion happens immediately. Your images are converted in place in their original location. If you selected lossy conversion, continue on to the next step.


If you selected lossy conversion, and you chose to view a preview of each converted image before saving, Android Studio shows you each image during the conversion so you can inspect the conversion result. (If you did not choose to view a preview, Android Studio skips this step, and converts your images immediately.) During the preview step, you can adjust the quality setting for each image individually, as described below

Leave a Reply

Your email address will not be published.