A little trick to add WebP "transparency" support on pre-4.2 devices

WebP is great, but transparency WebP is only supported natively on Android since 4.2.1. Even though everyone should have minSdk set to at least 19 by now, for apps that sill have a large amount of users on pre-4.2 devices, there's a little trick maybe apply to you for adding WebP "transparency" support.

The cwebp CLI provides an option called -blend_alpha which allows you to blend the alpha channel using a solid color. What that means is if you have a large PNG image with transparency area but always lays on top of a known background color, say white. Then, when you convert that PNG image into a WebP image, you can use -blend_alpha 0xffffff option to blend the alpha channel with white color. This will not only reduces the image size, but also works on pre-4.2 devices.