5

I have below doubts on webP

Can i convert and use all PNG/JPEG images in project to WebP format .?

or is there is specific PNG/JPEG images only i can convert to WebP format and use it Project like only banner images .?

Vishwanath.M
  • 6,235
  • 11
  • 42
  • 56
  • If you want to serve WebP images for saving bandwidth and faster loading times, then check out [ImageKit.io](https://imagekit.io). Along with format conversion, you can resize, crop and play with a lot of transformations provided, using URL parameters. – manu4543 Dec 20 '17 at 10:52
  • Official Google Documentation - https://developer.android.com/studio/write/convert-webp – MrVasilev Mar 27 '23 at 06:49

2 Answers2

6

Yes you can convert all PNG/JPEG to WebP format. There is no rule that only banner image can convert to WebP format.If you really concern about your application's apk size than it is good practice to convert images to WebP which you are using in your project.

Issue which you might face when converting image into WebP format as i have already faced:

If you are already using .webp images in your project, lint will check for two things: If you minSdkVersion is less than 15, you can't use .webp (unless the .webp image is in a -v15 folder or higher.) If your minSdkVersion is less than 18, it looks at the actual contents of the .webp files and if it finds that it is using transparency or lossless encoding, it emits a warning that this requires API 18. (Again, placing these folders in a -v18 or higher folder is fine.)

Most important is:

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.

You can find this notes from this link also

Hope this can clear your doubt if still any doubt you can ask here.

Lokesh Desai
  • 2,607
  • 16
  • 28
1

No you cannot convert files with transparency or alpha channel if your minimum sdk is less than 18

From Android documentation :-

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.

Other than that there is no restriction .

gautam
  • 1,701
  • 2
  • 17
  • 33
  • Hi am asking about what and all PNG/JPEG images i can convert.? wether i can convert all images inside project or only banner kind of images, is there any guidance for this.? – Vishwanath.M Dec 20 '17 at 05:11
  • you can convert all kind of images in android app there is no problem in that, i personally have converted all images in android apps and it is saving apk size. – gautam Dec 20 '17 at 05:34