JBIG Android library published
Include the dependency into your gradle script
Please jump to jbig-android's home page.
jbig-android is just a jni level wrapper of jbig-kit, so it inherited its License as GPL v3.
If you are an 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 a MVC way, which took me the most time, and it succeed, 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.
About years ago, I met this problem, the format of hand write 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.
3 Include the dependency into your gradle script
allprojects { repositories { jcenter() maven { url "http://ift.tt/1iuzuMJ" } } }
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's dependencies scope.
# 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 support 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.