Skip to content

webp support for Android API Level 4 and up, includes the native library and a WebPImageView to render webp in your app

License

Notifications You must be signed in to change notification settings

hamiranisahil/webp-android

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webp

webp for all! (Android devices)

webp is a library we use at EverythingMe Launcher since we love webp. We use it to save bandwidth as well as shrinking our APK sizes.

webp is an adaptation of chromium's webp decoder, and an addition of a JNI wrapper to easily use it it in your java code.

compile

just gradle clean build, and add the output aar to your libs (a public aar will be available soon)

How to use it?

import me.everything.webp.WebPDecoder

Bitmap bitmap = WebPDecoder.getInstance().decodeWebP(bytes);

WebpImageView

We also made it easy to load webp images from xml to an ImageView

<me.everything.webp.WebPImageView
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  webp:webp_src="@drawable/your_webp_image" />

Native webp support with lossless and transparency is officially supported in Android 4.2.1 and up. Prior to that transparency was not supported. Since both 4.2 and 4.2.x have the same API level (17), we apply webp's decoding for all API levels lower than 18. For API level 18 and up we apply the standard BitmapFactory.decodeByteArray().

About

webp support for Android API Level 4 and up, includes the native library and a WebPImageView to render webp in your app

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 95.1%
  • M4 1.6%
  • Roff 1.2%
  • Makefile 0.8%
  • Python 0.5%
  • Objective-C 0.2%
  • Other 0.6%