Table of Contents
Thus, WebP images provides best of both worlds from JPEG and PNG.
Using WebP developers can create smaller sized images suitable for the web which makes the websites load significantly faster than traditional JPEG or PNG.
Android APK size can also be reduced if project assets are properly converted to WebP format.
To learn more - WebP
For Android ,
This guide will help you learn to convert PNG or JPEG images into WebP using Android Studio. Similarly you can also convert other supported formats as well.
Add Images to Project |
Android Studio - Convert to WebP |
Keep the defaults settings.
Note : Backup your images as this tool will overwrite the existing jpg or png image.
Converting Images to WebP |
Click OK
JPEG VS WEBP |
In Lossy Encoding option, a Preview Window is shown to adjust the quality of image after compression.(This appears as we have selected “Preview/Inspect each converted image before saving” option in previous dialog box).
You can try and play around with the quality percentage settings to adjust according to your project requirements.
Note : If you set the quality percentage to 100 % and the minSdkVersion is set to 18 or higher, Android Studio automatically switches to lossless encoding instead.
Skip images with transparency/alpha channel checkbox is automatically selected if your minSdkVersion is lower than 18
Click Next or Finish
Your converted images are available in original image location
Note : converted images overwrite the existing jpg or png image
Convert the PNG image to WebP
Similarly, we can convert png image to WebP using the same steps as mentioned above.
PNG vs WEBP |
We can create significantly smaller sized images using WebP format
Also try lossless encoding, but usually the file size is larger than the lossy encoding.So prefer lossy encoding unless you require transparency or greater quality and size reduction is not your concern.
Lossless encoding converts instantly no preview available & You converted images are available in the same original image location.
Bonus Tip : Convert WebP images back to PNG
Android Studio - Convert To PNG |