JBIG Android library published
JBIG Android library published
Table of Contents
- Design details
- Where it come from?
- Include the dependency into your gradle script
- Start to use it
Please jump to jbig-android's home page.
1 Design details
jbig-android is just a JNI level wrapper of jbig-kit, so it inherited its License as GPL v3.
If you are a newbie of JNI programming, you can refer my JNI tutorial. Basically, JNI part is the key of porting jbig-kit to android platform.
Beside the core implementation of this project, the sample code pleased me the most. I tried to wrote it in an MVC way, which took me the most time, and it succeeds, Maybe I will use another post to describe this MVC paradigm and its apply in Android App. Of course, I learned this way and copy it from Chris Banes's sensational work philm.
If you are a newbie of JNI programming, you can refer my JNI tutorial. Basically, JNI part is the key of porting jbig-kit to android platform.
Beside the core implementation of this project, the sample code pleased me the most. I tried to wrote it in an MVC way, which took me the most time, and it succeeds, Maybe I will use another post to describe this MVC paradigm and its apply in Android App. Of course, I learned this way and copy it from Chris Banes's sensational work philm.
2 Where it come from?
About years ago, I met this problem, the format of hand write a signature in bank related system, like a POS. The customer sign in the screen(LED) during a bank card payment. And those signatures are stored in the back-end server, of course, in a lossless image compression format, in this case, is the JBIG.
I studied this format, and implemented it in android platform until my employer stopped use it and abandoned it in his product, I started to open source it. Yeah, I really enjoy my works in this field.
I studied this format, and implemented it in android platform until my employer stopped use it and abandoned it in his product, I started to open source it. Yeah, I really enjoy my works in this field.
3 Include the dependency into your gradle script
allprojects {
repositories {
jcenter()
maven {
url "http://dl.bintray.com/suzp1984/maven"
}
}
}
Add my bintray repo into your root build.gradle.
dependencies { compile(group: 'org.jacob.lib.jbig', name: 'jbig-android', version: '1.0', ext: 'aar') }
Then, add above line into your modules' dependencies scope.
4 Start to use it
# encode code Bitmap[] bitmaps = ...; JbigCodec jbigCodec = JbigCodecFactory.getJbigCodec(JbigCodecFactory.CODEC.JNI_CODEC); byte[] jbigData = jbigCodec.encode(bitmaps);
Above code is what I said jbig encoding from multiple layers of Bitmaps. Because Jbig supports multiple layers.
# jbigData is the above byte[] jbigData. JbigCodec jbigCodec = JbigCodecFactory.getJbigCodec(JbigCodecFactory.CODEC.JNI_CODEC); Bitmap[] bms = jbigCodec.decode(jbigData);
And this is the decoder part, the reverting process of above encoding, here it decode the jbigData byte array to multiple layers of Bitmaps.
Comments
Post a Comment