Android encoding NDK NDK

How can I encode an ARGB pixel array into a JPEG (jpg) file using NDK in C? But not using any call to the Java API wrapper? I saw that there is a libjpeg library call, but I could not find any tutorial on how to use it in the NDK. Extra options?

+4
source share
2 answers

Here is a tutorial for you, please check http://www.usefullcode.net/2011/01/android_ndklibjpeg.html to open this link in Google Chrome or another browser using google translator

+2
source

In addition to JNI calls, there are at least 2 options:

1) Use libjpeg directly. The source code can be downloaded here: http://www.ijg.org The source code is very convenient for NDK, and you just need to create Android.mk/Application.mk for the project. However, the libjpeg API is rather complicated.

2) Use the wrapper image library. I recommend using FreeImage : http://freeimage.sourceforge.net It has a very clean API, it can be easily compiled for Android (no autoconf configuration required) and (used in the Unity3D engine). As an added bonus, you can read and write many other image formats other than JPEG. In fact, it contains libjpeg , but provides a cleaner API.

+1
source

All Articles