Encode Bitmap To Webp With Libwebp On Android Pre Api 14 Device
I want to encode Bitmap to webp on Android 2.x device with libwebp. Below is my testing code public static int createWebPImage(Bitmap bitmap, String outFilePath) { Log.d(TAG,
Solution 1:
After read the docs from Google, I found the stride parameter was wrong. It should be counted as bytes. Then I changed the encode function call to
WebPEncodeRGBA(buffer, width, height, width * 4/* stride in bytes */, 0.9, &output);
It worked.
Post a Comment for "Encode Bitmap To Webp With Libwebp On Android Pre Api 14 Device"