2

I was using opencv for some time for programming in Android, and I now see that the Gimp library is much stronger. Where can I find a starting point to learn Gimp? I also want to know the basic concepts behind of Gimp plugins. In the past, I used C APIs in opencv. How could I write the code for android? Also, what packages do I need to install in windows to start using Gimp?

StephenA
  • 61
  • 6
Sayak
  • 339
  • 1
  • 6
  • 19

2 Answers2

2

ALthough GIMP dows have some standalone libraries that perform some image manipulation, most image manipulation is done either by GIMP's core program or through GIMP's plug-ins. Both approaches need to have the entire program installed and running (though not necessarily usin a display).

I know nothing on Andorid progrmaing, and don't knwo how can one install ordinary native code in C and call it from Android apps - if you are very familiar with it, you might have a chance in your attempt.

However GIMP itself relies on a extensive ecosystem of libraries, including, but not limited to, glib, gtk+, cairo, pango, gegl - and each of these in turn might have other pre-requisites. Since Windows does not have a working package manager to authomatically install libraries and header files of these various libraries, working with these natively on Windows, though the code of each of them is multiplatform and can run on Windows and other OSses,is very hard. So hard that hthe people who build GIMP for Windows themselves do so in a Linux environment, from where they cros-compile GIMP for Windows.

Making all of these libraries work on an Android is probably not hard if you are using the GNU ecosystem around the Android's Linux kernel , and not just the bare Android environment (I don't know enough about android to even know if that is possible).

All in all: it will be though for you, and demand a whole lot of research.

One of GIMP's libraries, the GEGL (Generic Graphics Library) has a lot less prerequistes, and can be used as an ordinary library. I think you can probably build it with just glib and Babl as prerequisites. This is the library that will replace current's GIMP core, and reimplement the operations of most existing plug-ins -- so it might be enough for you.
If you can get GEGL running and usable from an Android system share that with the World --it would be , in itelsef, a project worth of a Google Summer of Code project. (And still would be about an order of magnitude easier than getting GIMP code in there to be used as a library from other applications).

Finally -- if you want just a couple of GIMP's effects, if the effect is implemented as a Plug-in in GIMP, the plug-ins' code is quite straightforward. So, while it would be hard to get the whole GIMP environment inside Android, copying the functions that actually perform the pixel manipulation from GIMP's source tree and converting them to work in a java method inside your app would not be hard. Just remember to comply with the license in this case: GIMP's plugins code is under GPLv3. (the GEGL library is only LGPL)

In short: no, you can't use GIMP's "libraries" as native code from an Android app -if you can use OpenCV, you have a good chance of being able to use GEGL instead. Only orting the algorithms of certain plugins to manipulate pixels in your app would be easier.

However -- if your application would allow delegating Image Processing to an internet based server, setting up an HTTP application to receive a image, use GIMP to process it, and stream it back would be a simple thing to do.

(So, you could not apply effects in real time, but would allow one to, for example, take a photo, select a series of effects from menus, and send it to the server for processing)

jsbueno
  • 99,910
  • 10
  • 151
  • 209
  • for OpenCV, i use JNI to call the native codes and use it in Android. is it not possible to do the same for GIMP? i know that applications like PicSay and FotoFunia uses GIMP library. from your answer i can see that GEGL is a good alternative. which environment do i need in windows to run GEGL library? – Sayak May 05 '11 at 03:11
  • What i see about GEGL is that it supports non destructive image manipulation. Can i make the simple image effects like sobel? is it possible to use manipulate the image layers in GEGL? bcos that was the whole point of changing from OpenCV as i cant make a transparent layer in OpenCV. – Sayak May 05 '11 at 03:46
  • Intresting..if there are apps that use GIMP's libraries in andorid, then maybe it is straightforward Linxu build that works. For using any GIMP library, includign GEGL in Windows, you should only need to install the application (using the GIMP windows installer) and grab the .h files from the source code tar balls to include in your applications. – jsbueno May 05 '11 at 04:02
  • As for usign layes in GEGL - that is the whole point of GEGL -- it is a bit diffent than "layers" as we see them in an image program, but GEGL documentation (on www.gegl.org) are quite clear on how it works. – jsbueno May 05 '11 at 04:03
  • @jsbueno, thanks a lot... i need some time to implement all these and start making simple programs. i will continue to report back in this thread about the results. – Sayak May 05 '11 at 04:08
  • @jsbueno... i am having some problem to build the GEGL library. i have asked the question in the forum. please take a look... – Sayak May 18 '11 at 06:24
1

GIMP uses quite a bit of memory when loading brushes. If you drop all of the useless plug-ins, and build it from source. You may be able to get it working but you will have to build ALL of the linked libraries directly into the executable.

In other words; build linked libraries directly into the code as a static build. In this manner things may function properly unless one of those linked libraries call another linked library.

Getting the libraries themselves to work on the OS may provide additional programs opportunities to use them. Additionally, GTK+ (GIMP Tool Kit), GIMP's interface is also rather bloated and ugly.

If all else fails, you'll simply have to settle for a smaller program with the features you're looking for on the fly ( Levels, Curves, the clone tool, dodge and burn, etc. ) Layers are also nice, but editing a a large megapixel image begins to eat up memory rather quickly and most android device don't have a swap partition.