How to get familiar with GIMP codebase?


Hi folks,

I was wondering… is there a good overview/tutorial for beginners to learn and get familiar with GIMP/GEGL codebase?

Using Elle Stone’s script, I find most source code is inside /home/pinto/code/gimpdefault/build folder. Is there any source code outside this folder?

I am especially interested in GIMP filters and corresponding performance.

(Elle Stone) #2

I’m not sure what you mean by source code outside the folder. But when compiling GIMP from git, from source, using the folder structure suggested in my article, all the source code for babl/GEGL/GIMP is in the build folder.

In case it helps, here are some general starting points for anyone wanting to work with GIMP code:

GIMP depends heavily on babl and GEGL:

  • Babl handles (among other things) bit depth and color space transforms, including conversions between linear sRGB and regular sRGB (that is, encoded using the “almost perceptually uniform” sRGB companding curve), and conversions to and from XYZ/LAB/LCH.

  • GEGL handles image buffers and many (but not all) image-altering operations, including scaling and other transforms, and most of the filters and color operations in the GIMP menu.

  • GIMP handles layer blend and composite modes, color management, the user-interface, some filters, plug-in code, display modules, import/export, various operations available in the GIMP menu that aren’t handled by GEGL, and etc.

In a sense babl/GEGL/GIMP become one great big program via these two “include” lines, which are liberally sprinkled throughout GIMP code:

#include <babl/babl.h>
#include <gegl.h>

The relevant babl functions that GIMP and GEGL use are fairly well documented by comments in babl/babl.h, in the babl build folder.

babl/GEGL/GIMP are mostly written in c, with a little c++. Information/buffers/etc are passed back and forth between babl/GEGL/GIMP using structures. The code makes heavy use of pointers.


  • “main ()” in “app/main.c” is the first code that’s run when you start GIMP.
  • main () calls on the function “app_run ()” in app.c.
  • “app_run ()” calls on “gimp_gegl_init (gimp)”, which I’m guessing is where all the communication between gimp and gegl starts.

After that, tracking what happens when and where can be done using GDB, if you have a lot of time and patiences, and by using temporary write statements if you have an idea where to start. Probably there are other ways that an actually skilled and knowledgeable programmer would use (I can program, but I’m neither skilled nor knowledgeable).

I don’t have any clue about checking performance, but the topic comes up on the GIMP dev mailing list from time to time.

Here are some useful links: - the best place to interact with the babl/GEGL/GIMP devs - also a place to interact with the devs

babl/GEGL documentation:


GIMP Developer wiki:

(Pat David) #3

This is important, as the most knowledgeable folks are here and usually able to answer questions in real-time. @Elle isn’t always there, but she’s usually around (as you’ve seen), and quite dense with information to assist (so take the time to read carefully).


Thanks very much Elle for your detailed answer and info!

I will definitely have a go at it!

(Elle Stone) #5

“Performance” is determined by a lot of factors: in the code, in the way the code is compiled, in the parameters used to start babl/GEGL/GIMP, in options set in GIMP Preferences. Plus of course the user’s operating system and hardware also makes a difference. Here’s a post I started several years ago, that specifically asks about what the user can do to make GIMP run faster (fortunately the old machine I was trying to run GIMP on finally stopped working):

You mention filters, but different filters benefit from different types of code modifications. For example if you are interested in “Filters/Noise/CIE lch noise”, then the speed at which LCH transforms are done becomes relevant. Here’s a recent bug report about making these transforms faster: - I don’t know how the “time” measurements were made, but if you ask on IRC, someone will surely have the answer.

I can’t find the link, but there was a discussion on the developer’s list about the slowness at which the canvas is redrawn. Some filters actually work a whole lot faster than you might think, but they seem slow because of the speed at which the image is redrawn on the screen.

The goal of course is to increase performance without reducing accuracy. I’ve been told that GIMP’s image display is superior to PhotoShop’s. But PhotoShop’s display is faster. I remember using CS2 many years ago, and the display of linear images was severely posterized until the image was zoomed in to 67%.

If you search through posts to the GIMP user and developer’s list, questions about making GIMP faster/improving performance/etc come up a lot.


Thanks Elle!

I was interested in finding out why when I use some of the slow filters (Artistic -> Waterpixels for example) on a 16M photo, It does not show the progress circle and takes way too long to do the calculations. Again, the waterpixels output is amazing, but it is slow and the user as no clue as when it will be ready, since the progress bar does not update. in fact the whole UI freezes when you use the waterpixels filter on a large enough photo.

So… I searched for the waterpixels source code in the GEGL directory. And found a file called waterpixels.c in the /gegl/operations/common directory. I then played a bit with the code. Is it enough to compile and run the new zombie gegl library I have created to go on gimpdefault/build/gegl directory and type make (and then start ./gimp-2.9)?

(Elle Stone) #7

Hi @SheetM - I’m not sure what a zombie GEGL libary is, but if you modify some part of the GEGL code, usually it’s enough to just do “make && make install” for GEGL, without having to also recompile GIMP, assuming of course babl/GEGL/GIMP were already compiled and installed.

Sometimes changes in GEGL do require recompiling GEGL and also GIMP, sometimes even starting over with ./ for both GEGL and GIMP - the “symptom” being that GIMP complains about two plug-ins for the same thing, or other such complaint, in which case sometimes you might also need to delete files from the install folder, just to make sure all the old stuff is really gone.

But for smaller changes in GEGL, just “make and make install”, with no need to also reinstall GIMP, is sufficient.

If there is a GEGL filter that’s really slow and doesn’t have a progress bar that updates, and sometimes freezes GIMP, this is a good thing to ask about on IRC, and/or file a bug report.


Many thanks Elle!


Thanks. I have a problem though: when I try irc://, HexChat says:

 Python interface loaded
 Sysinfo plugin loaded
 Perl interface loaded
 FiSHLiM plugin loaded
 Lua version 1.3/5.3 loaded.
 Checksum plugin loaded
* Looking up newserver
* Unknown host. Maybe you misspelt it?
 Cycling to next server in irc://

I can only connect to irc://

Do you know what could I be doing wrong?



Edit: In Hexchat you also don’t need the irc:// part. Maybe that’s the problem?

(Elle Stone) #11

Hmm, too many irc’s that end in “gimp”:

This is the correct one for GIMP development:

There is an irc named “gimp” at “”, but it’s the wrong chatroom (is “chatroom” the right terminology?) - edit added: This isn’t true! as @houz notes below, one is just an alias for the other.

I don’t know how to use HexChat. But an easy way to access is to install Chatzilla in Firefox and just click on the irc link from

(Elle Stone) #12

@patdavid - Maybe it would be a good idea to add a note to the irc page, somehow letting people know that “#gimp” isn’t enough, the rest of the address also matters?

Not too long ago I was having an email exchange with a person who was a bit upset that no one on IRC was responding to the person’s questions, and it turned out that person was in the wrong “#gimp” chatroom.

Also I seem to recall one or two other people saying they were being ignored on irc, which seems completely at odds with my own observations about gimp irc, which is that questions are usually answered fairly quickly. So in retrospect it seems possible these other people also might have been in the wrong irc chatroom.

(Morgan Hardwood) #13

The server is and the channel is #gimp, so to connect using a proper IRC client:

/join #gimp


Again, I get

Cycling to next server in
* Disconnected ()
* Looking up newserver
* Unknown host. Maybe you misspelt it?

When I use Hexchat. I must be doing something wrong as I can only connect to |irc:// !

(Alan Gibson) #15

I can’t speak about Gimp internals, but my own (unpublished) editor which is built using ImageMagick for the backend and Microsoft Windows for the frontend has exactly that issue. For most effects on 35M pixel images, the effect itself is fast, but the speed for transforming that result to the approx 2M pixel screen is comparatively slow. The “proper” resizing method is too slow for real-time updates when sliders are shifted, so I use the less accurate sampling method that simply samples every 4 pixels or whatever. Other more complex techniques might apply the effect initially to just the screen buffer with background updates to the rest of the image, but that would massively increase complexity.

(Jonas Wagner) #16

You could try dig if that gives you something like

; <<>> DiG 9.10.3-P4-Ubuntu <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54144
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1

; EDNS: version: 0, flags:; udp: 65494
;			IN	A

;; ANSWER SECTION:		299	IN	A		299	IN	A		299	IN	A		299	IN	A

;; Query time: 213 msec
;; WHEN: Sun Jan 14 01:48:26 CET 2018
;; MSG SIZE  rcvd: 105

If that works, DNS is likely not the problem and you can try to connect to it via the telnet client:

Connected to
Escape character is '^]'. NOTICE AUTH :*** Looking up your hostname... NOTICE AUTH :*** Found your hostname

To get out you can send QUIT.

If that works something is fishy with your client. If it doesn’t then the connection might be blocked by a firewall rule. IRC used to be a popular way to control botnets (might still be…) so it is often blocked for “security” purposes.

In any case the easiest solution is likely to use a web based client like mibbit.

(Pat David) #17

It’s tough to troubleshoot irc client use. :slight_smile:

@Jonas_Wagner is on the right track with a web client, here’s a link that’ll connect you directly to #gimp:

#18 is an alias for, both will bring you to the same #gimp channel.

As the round robin name doesn’t work I’d like to see the output of nslookup from @SheetM

Edit: Jonas was faster.
Edit2: @SheetM: Please show a screenshot of how you configure the channel in Hexchat. Maybe you are doing something wrong there?

(Elle Stone) #19

Hi @houz - Hmm, you are absolutely right.

I had been in a long email conversation with a person trying to get onto #gimp irc, and whatever #gimp channel/chatroom they found, wasn’t the right one - we confirmed this because I opened the #gimp channel using chatzilla, and we weren’t seeing the same list of people on the channel, not at all.

I thought that person had typed in “”, but checking the email exchange, I’m not sure why I thought that’s what they had typed. Anyway, that person finally got on the right channel by using chatzilla.

My apologies for adding confusion to this thread!