My application needs to save large images in a lossless format. I’m willing to sacrifice some disk space for speed of saving and I’d prefer to save in some standardised format instead of rolling my own.
I’ve found the built-in .PNG encoder to be fairly slow for my needs, sometimes taking about 5 seconds to save a 1000×1000 image. I’ve found I can save images much quicker by saving the raw pixel values to disk (i.e. no compression) and by saving the raw pixel values compressed with Java’s deflate class with tweaked compression settings. Unfortunately, there is no option to alter Android’s PNG compression level that I know of.
What options do I have?
I’m prepared to use the NDK but I’m cautious about using an external library that hasn’t been well tested on Android. For example, libtiff would be a candidate but I can’t find any info on getting this working in the NDK and how stable it is.
Just throwing this out there but the newest version of OpenCV 2.2 comes with a NDK port to Android. This includes several image libraries including libpng and libtiff.
I haven’t personally tested the use of those via the JNI interface or stability but at least it compiles readily for Android using the NDK.