Android & Kotlin

Working with WEBP Image in Android

Pinterest LinkedIn Tumblr

In this post, We will learn uses of WebP image in Android. In earlier, You are heard many image processing library on android eg. Glide and Picasso. We mostly use  SVG and PNGs image file format for android app development.

Basically, The major problem is size of FILE and while we applied compression on image file the resulting quality is very poor. Because PNG and JPG have very different image compression processes and each reproduces different result.  

Image loading has consisted of more network traffic in android apps. the smaller image provides better network experiences. WebP provide guidance on making image file smaller and more network network-friendly.

WebP is lossy compression for image like JPEG as well as transparency like PNGs.  that provides superior image quality with 26% smaller size compared to PNGs and 25-34% smaller than JPEG.  The best things is it reduces the image size in a good amount without reducing the image quality.

With help of AndroidStudio, you can convert existing PNG, JPG, GIF or static BMP images to WebP format easily. In furthermore we will explain “how to create a WEBP image using AndroidStudio?”.

Convert PNG to WebP in Android Studio

Step 1.

Open Android Studio, and press the right click on your image that you want to convert in WebP, inside drawable folder such as below.

Step 1 – Convert PNG to WEBP
Step 2.

you will find the following dialogue, you can keep the default settings and move on or you can change to lossless if you are 4.3 or higher , also you can change the encoding quality.

Step 2 – Convert PNG to WEBP
Step 3.

After pressing OK, You can find The number of bytes saved from the compression in the right bottom notification in Android studio.

Convert WebP to PNG

Step 1.

Select the WebP image and right click on it after that one popup is appear like below figure, Choose Convert to PNG

Step 2.

Furthermore, You will find like below dialogue. If you want to delete WebP image then click Yes or want to keep click on No. If you want to cancel the action click on Cancel

PROS of WebP

  • Small File Size – It reduces the image size without reducing the image quality.
  • Increased Quality:- When you compare another file compression like JPG or PNG
  • Open-Source:-WebP was open-sourced provide by Google.
  • One Format to Rule them all: – We can replace all kind of file format by WebP.

CONS

  • In Android,  It supported in Android API level 18 and higher
Read our android architecture components tutorials series

Write A Comment