Skip to main content

The GNU Image Manipulation Program

Summary: In this reading, you will learn a bit about the GNU Image Manipulation Program (GIMP), an open-source alternative to Photoshop.


The GNU Image Manipulation Program (“GIMP”, for short) is an open-source, freely-distributed graphics editing program that can serve as a reasonable alternative to Adobe Photoshop. Like Photoshop, GIMP provides tools for both making new images and for manipulating existing images.

GIMP distinguishes itself from Photoshop in three key ways: First, it is an open source application, which means that you can get it for free and (if you have enough talent) can even modify the source code. Second, it is available on all three major operating system platforms (Mac, Windows, and Unix/Linux). Third, and perhaps most importantly for this course, GIMP is scriptable. In particular, you can interact with GIMP using a Scheme-like language. You can use this language to give simple commands or to write complex scripts.

We will explore these applications over the coming weeks.

Some Background and Context

Open Source Software and the GNU Project

As you probably know, the face of computing has changed significantly in the past twenty or so years. Until the advent of reasonably priced personal computers, most computing was done on large, shared, computer systems. To simplify matters, we’ll say that there were two basic kinds of computing that happened then: business computing and academic/scientific computing. (Yes, that’s a significant simplification.) In the business world, dominated by computers from IBM and its associated operating systems, there was an assumption that software either came with your computer or was purchased at a relatively high price. In the academic world, most people who needed custom software wrote it themselves and then shared it with their colleagues elsewhere (just as scientists regularly share research results, at least in an ideal world).

With the advent of the personal computer, the realms mixed somewhat (and, as importantly, expanded significantly). To many, this suggested that the business model could be more widely adopted. That is, your computer would come with a small, core, set of software and you’d buy anything else you wanted or needed. (It took some time for this model to develop; the first Macs shipped with free word-processing and drawing programs.)

Many long-time computer programmers were upset at this commercialization. In response, they began a number of endeavors to provide non-commercial alternatives to the commercial software. Foremost among these endeavors was the GNU (GNU’s Not Unix) project, which evolved into the Free Software Foundation (FSF). Richard Stallman, the driving force behind GNU/FSF believed (and continues to believe) that software should be free (as in “freedom”). That is, if you own software, you should be free to use it as you wish, to modify it to make it do other things, and to share it with others. Stallman also believes strongly in community development, so a requirement of his free software is that you share any useful changes you make with the community.

The GNU project led to the development of Linux, one of the first free, widely-used operating systems for personal computers. It also led to the more general Open Source movement, which follows many of the tenets of the FSF (particularly the distribution of the source code of software, so that you can modify it), but permits a bit more of a commercial spin on those tenets.

While Linux is clearly one of the great successes of the open source movement, there have been many others. For example, the Apache Web Server is an open source project that provides the most popular Web Server and the MySQL project provides an open-source database management system. One of Grinnell’s spam filtering systems is also open source software.

The Free Software Foundation continues to take the lead in many projects. Many of the compilers (the programs that programmers use to build programs) used today are FSF products. The Gnome graphical user interface that we use in MathLAN (the thing that provides windows and icons on our Linux boxes) is an FSF product. The FSF also produces alternatives to many commercial applications.

From your perspective, the most important aspect of open source software is probably that it’s free (as in “free beer”): You can get a copy from the Web without paying for it and you can legally use it. Eventually, it may become important that it’s modifiable (if it doesn’t do something you want it to do, you can change it yourself, hire someone else to change it for you, or rely on the community to change it). And, depending upon your perspective, it may become important that it’s unrestricted (or “free as in freedom”). Some of you may already have a political perspective that supports such freedom. Others of you are likely to find it necessary. As commercial software increasingly makes decisions as to what you can and cannot do, you will find unrestricted software more convenient.

As the introduction suggested, one of the more notable recent efforts of the FSF is GIMP. GIMP is a full-featured alternative to Photoshop, with some features that Photoshop lacks.

Obtaining GIMP

While the point of this reading (and this course) is not to teach you about open source software, it is important that you be able to get your own copy of GIMP so that, if you wish, you can explore the interaction between Scheme and graphics on your own computer. (You can also use it for your normal graphics editing tasks.)

You can normally obtain your own copy of GIMP from

However, we have added our own extensions to the GIMP, and have not yet had them received into the core GIMP. Hence, for this class, you will need to either use GIMP in MathLAN or use the virtual machines we distribute. Those who are more adventurous can try using the VNC to connect your home computer to MathLAN.

Starting GIMP

You start GIMP as you would start most applications. However, since you have just started using Linux, we thought a bit of guidance would be helpful. On our Linux workstations, you have two options for starting GIMP: You can click on the icon that you installed. You can also open a terminal window and run the following command:

$ /home/rebelsky/bin/gimp

The first time you start GIMP, it needs to set up a lot of configuration files. Expect to wait a minute or two (sometimes even before you see a result). Be patient!

Once GIMP starts, you should see two windows: a main GIMP window (titled GIMP) and a second helper window (labeled Layers, Channels, Paths, …). You may also see a GIMP tip, which you can close.

The GIMP User Interface

The GIMP’s user interface was designed by people who think a bit differently. You may find it awkward at first, or you may find it more natural than many user interfaces. Some things that affect the global GIMP environment, such as choosing tools and creating new windows, is done through the primary GIMP window. Other things that affect individual images, are done through menus associated with those images.

To create a new image, you select New… from the File menu. A dialog box appears that asks you to select the width and height of the image (and, optionally, a number of “advanced options”, such as the resolution of the image or the color space).

Once you’ve created an image window, you create the image or modify it using a combination of tools and menu options. It is not the goal of this document to present you with a comprehensive guide to painting in the GIMP, so we will only discuss a few tools briefly. Consult the official documentation or a variety of handbooks for more information.

Freehand Drawing in GIMP

One way to use the GIMP is to do freehand drawing. (Clearly, for real drawing, you would want to use a tablet rather than a mouse.) For most freehand drawing, you follow three steps. First, you select the brush tool. (That is, the one that looks like a paintbrush.) Second, you select a brush that you want to draw with. You do so by clicking on the picture next to the label Brush and then choosing a brush. Third, you select the color. It may be easiest to select the color from the GIMP helper window. You can also double-click on the foreground color in the primary GIMP window and then select a color from the dialog that appears. You can also set a variety of other characteristics of the brush; those characteristics are beyond the scope of this document.

Once you’ve selected your drawing tool, you click and drag on the screen.

Drawing Regular Shapes

Since most of the drawing we do in this class will algorithmic, rather than manual, we will often talk about drawing in terms of regular shapes, such as lines, squares and circles. It is, of course, possible to draw such shapes by hand, although the technique may be a little bit different than you’d expect.

In most cases, drawing of regular shapes in GIMP is a two-step process. First, you select the shape of interest. Next, you either fill it with a color (or pattern) or outline it (with a solid line or with the current brush). To select a shape, click on the rectangle tool or the oval tool. Then, click and drag on the image. To fill the selected area, use Fill with FG Color (or one of the variants) from the image’s Edit menu. To outline the selected area, use Stroke Selection …, which also appears in the Edit menu. After you select that menu item, a dialog will appear that gives you the option to choose between stroking with a solid line or a drawing tool.

It is possible to draw more interesting shapes by combining selections. If you hold down the Shift key when making a subsequent selection, the new selection is added to the previous selection. If you hold down the Ctrl key when making a selection, the new selection is removed from the previous selection. If you hold down both the Shift and Ctrl keys, the new selection is intersected with the previous selection (that is, the resulting selection consists of only the parts that are in both the previous selection and the new selection). You will explore some of these options in the corresponding laboratory.