What is a WebP image ?
WebP is a modern Image Format that provides superior lossless,transparent (like png) and lossy compression(like JPEG) for images. These images are 26% smaller in size ( with lossless compression) as compared to PNG and 25-34% smaller (lossy compression )as compared to JPEG .
Lossy WebP images are supported in Android 4.0 (API level 14) and higher,
Lossless and transparent WebP images are supported in Android 4.3 (API level 18) and higher.
In this tutorial I will show you how to convert a png image to webp using Android Studio.
1. First update your Android Studio to 2.3
2. Android Studio can convert PNG, JPG, BMP, or static GIF images to WebP image.(9 Patch files cannot be converted.)
Right click on a image in your project or a image and click on “Convert to WebP”
3. One dialog will appear like below :
Skip images with transparency/alpha channel is automatically selected if minSdkVersion is lower than 18, because you can create transparent webP images only if your minSdkVersion is 18 or higher.
4. Click OK and the conversion will start.
a. For lossless encoding conversion, it will convert and replace the image automatically.
b. For lossy conversion, it will show you a dialog as below :
Left image : original image
Right image : final webP image
Middle image : difference between original and final
You can easily change the quality/encoding of the image by changing the “Quality” bar.
Click on ‘Finish” and your webP image will be replaced with the png one.
WebP image to PNG :
You can also change a WebP image to PNG . Right click on a webP image → click on convert to PNG. Thats it. If you love this post, don’t forget to like our facebook page (https://www.facebook.com/codevscolor/) and register for the weekly news letter 🙂