Reduce .apk file size by WebP

If we are dealing with the application which uses significant amount of images then png and jpeg format would be occupying more space. WebP is the Image format from Google for better compression than JPEG and PNG files. Using WebP developer can create rich and compact image. The statics shows that lossless image is 26% smaller than the actual PNG file and lossy image is 25- 35% smaller than JPEG image.

What is Lossy and Lossless image

When the image is uncompressed and compared with the original file than all the data is matched with the original file, this is termed as lossless image where no data loss is taken place. However if the uncompressed image losses some part of the data and which is not noticeable than it is called as lossy image

Android 4.0 (API Level 14 )added partial support for Google’s WebP image format. This partial support included lossy image support. In Android 4.3 (API Level 18) devices supported the features which where not found before, like Lossless and Transparency support.

Convert image in WebP Image

Individual Image file or a complete Image Folder can be converted into WebP Image in Android Studio.

  • Right click on an image file or a folder containing a number of images files, and then click Convert to WebP.
  • When the dialogue opens select either lossy or lossless encoding.
  • Click OK to begin conversion.
  • Select a quality setting for each image you review. You can see the actual size and the modified size of the file in below image. You also observe the difference of both the image in middle row. Even though it has undergone lossy encoding the difference after modification is not noticeable
  • Press Finish and your image will be converted in the place in the original location.
  • After completing the process you will get a pop up indicating the the size saved after converting the image into .webp image format
  • Now the image is stored in .webp format replacing the original .png file
  • It is also possible to convert the image back into .png format. Right click on the image and select “Convert to .png” and it will replace the .webp image to .png image.

Point to remember

  • We cannot convert the 9-patch image to WebP image format as the tool will automatically skip this image

WebP Image format can save incredible amount of size if you have many images in your app. This will eventually will decrease the .apk file size. I would recommend to save image in .webp format as a first step in decreasing the apk size.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s