Do not use WebP to make app logo, logo or old honest practical PNG bar.

Loading is slower than PNG

The most obvious problem with WebP compared to PNG is that it takes a little longer to load, but this difference is getting smaller as smart devices become more and more sophisticated. Tencent has a very good analysis of WebP before, if you are ready to use webP, then it is definitely worth a look.

Webp takes longer to encode, more than five times as long as PNG, but decodes as fast as PNG, or even faster in many cases. Webp takes up 25% more memory for encoding and 30% less memory for decoding than PNG. — From WebP principles and The Current State of Android Support

Only support 2 +

The official documentation says that only in 4.2.1+ and above, can parse lossless or transparent webP images, 4.0+ only began to support non-transparent WebP images. I found through cloud testing that in 4.0~4.2.1 systems, webP pictures with transparency would not crash, but could not be displayed at all.

In the article “APK Slim Down, how to achieve up to 53% compression effect”, it is also mentioned that JPG images with alpha value cannot run on Android system 4.0 and 4.1 after webP conversion. The specific reasons are listed in the official document:

image_1asbq6bejqva1mtuvaj3kc1al22n.png-14kB

Model compatibility is not ideal

In addition to compatibility issues, WebP can have some weird issues on some models and ROMs. On some Samsung models, there will be a clear black line in the graphs with alpha channels (Samsung ROM support for Shape’s Alpha is also a red line). On the phone whose Mi 2 is brushed as 4.xx, the system fails to recognize the WebP picture described in the XML file, which will also lead to webP loading failure.

Not easy to preview

Because the image format of WebP is difficult to preview, and THERE is no way for AS to directly preview webP format, I usually open WebP through Chrome browser, which is very inconvenient.

Image_1asbq487rk9b1ff514p7nrefe02a. PNG – 115.1 kB

When we know the gradle build, there is a mergeXXXResource Task, it will be all the res in the project of the aar resources unified integrated into/build/intermediates/res/flavorName / {buildType} directory.

WebpConvertPlugin Gradle inserts a Task between the mergeXXXResource Task and processXXXResource Task. The Task will process the drawable in the same directory. PNG and JPG pictures in the project directory (excluding.9 pictures, the display effect is not good after webP conversion) are processed into WebP pictures in batches, so that we can use PNG and JPG in daily development and webP in formal package delivery.