Android WEBP codec detailed _android

Source: Internet
Author: User
Tags webp

Key words:android decode WEBP sample

When I knock down the keyboard when there is a deep sense of shame, see the Android 4.0 support WEBP format image, so I am looking for the provision of what kind of api,nnd, obstinately did not find, then hold a try mentality, with bitmapfactory to read, the result is not a problem. Come to a conclusion, as a code farmers, to dare to try to dare to do!

WEBP decoding

It's no different from your decoding jpg, it's in the drawable or somewhere, and then

Bitmap bmp = Bitmapfactory.decoderesource (Getresources (), R.RAW.WEBP);
Imv.setimagebitmap (BMP);

So, it's on top of the ImageView. Of course, this approach is only feasible in 4.0. If you want to be compatible with the old version (Android devices under 4.0), then you need to use the Jni method. Here gives the StackOverflow the above method, need to try, with JNI package, also not much trouble. Here is not done, give a link, need to be able to get down.

Http://stackoverflow.com/questions/7032695/webp-for-android

WEBP Code:

Coding is no different than your bitmap code, ICS Bitmap.compressformat This enumeration has WEBP, so support encoding into this format. Have Fun,good luck!

The above on the Android WEBP codec data collation, follow-up continue to supplement the relevant information, thank you for your support of this site!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.