Fun with GIMP


While at work this past week and was helping a user figure out how to measure something in an image. We both knew Adobe’s Photoshop a measure tool built in, but that software is hundreds of dollars and overkill for the users purpose. I then thought of GIMP, the GNU Image Manipulation Program. It had many of the same features of Photoshop and was free. All of this eventually led to me going back home this week and playing around with GIMP… Again…

For what it is, GIMP is a great application: a complete image editing program with the ability to rival Adobe Photoshop. On top of that GIMP is free, open source, and available for many different operating systems. Personally, I have one issue with the current version of GIMP. Because I use OS X on my PowerBook GIMP has to be rendered in X11. That wouldn’t be a big problem if it wasn’t for the fact GIMP breaks the toolbox, image window, and layers/channel/paths into individual windows. The File, Edit, View menus also exist within the main window, which breaks the OS X GUI standards for having a unified menu bar at the stop of the screen. See the example of what I’m talking about below.

Screenshot of GIMP on OS X

Some would argue that OS X is the primary problem because its interface does not follow conventions used by other operating systems. While that may be true I do not want to get into the debate of the reasoning behind interface design. That’s something like the people at Ubuntu are thinking about as they decide which corner of a window the Exit button is placed. Rather, I would like to look at the three options available for Mac users who want to use GIMP and help with a few of the annoyances.

1. GIMP 2.6 + X11 hack

The simplest way to use GIMP is to download the binary package available from http://gimp.lisanet.de/Website/Download.html. This is the latest stable version of GIMP and is a self-contained application with all of the library and support files bundled. All the user has to do is download the correct version of GIMP for their OS and install. As I mentioned earlier GIMP separates everything into separate windows. Because of the design of X11 for OSX when a user wants to change the tool in use they must first click on the toolbox window to activate it and then click the tool they want to use. So that’s an extra click for every tool change, layer change, etc. The solution is to enable a preference setting for X11 that follows the focus of the mouse. So if the user moves their mouse pointer over the toolbox window, that window will become active and they can choose the desired tool. Here are the steps
1. Open Terminal
2. Copy, paste the following setting into the Terminal window

a. Tiger: defaults write com.apple.x11 wm_ffm -bool true
b. Leopard/Snow Leopard: defaults write org.x.X11 wm_ffm -bool true

3. Press Enter

2. GIMP 2.6 with Quartz Rendering

An alternative to the standard version of GIMP is to build custom version and have Quartz support. Quartz is the built in screen renderer of OS X. Everything you see on the Mac desktop, from the icons and text, to the menu bar and windows, are all drawn using Quartz. So if GIMP uses Quartz then many of the GUI problems should go away. There is one problem though. Getting GIMP to use OS X’s built in Quartz renderer instead of X11 is no easy feat. There is no precompiled binary or bundle of this “variant” so the only option is to compile the software yourself. Back in the day before there were installation managers for OS X and GNU/Linux distros, a user would need to find out what libraries and programs were needed to compile a specific application. Today that is automated with tools like MacPorts of OS X. The result is a version of GIMP that uses the menu bar of OS X and the tools on any window are one click away. Here are the steps for building GIMP with quartz support

1. Go to http://www.macports.org
2. Follow the instructions for installing MacPorts, and Xcode tools
3. Follow the instructions for updating MacPorts
4. Run the following command: sudo port install gimp2 –x11 +quartz +no_x11
5. Wait for the next 12-48 hours for MacPorts to download and compile the 194 support applications/libraries required to build GIMP
6. Once the compilation and installation is complete, execute the following command to start GIMP: gimp

Screenshot of GIMP using Quartz

*Note: If you have trouble compiling or starting GIMP, see the appendix below

3. GIMP 2.7

The final option, and probably the best long term solution, for making GIMP work better on OS X is actually being integrated directly into the application by the developers. In the current development build of GIMP there is an option to make exist inside one single window. With one window the issues currently plagued by the GUI implementation for OS X should go away. The Toolbox and Layers window should be easily accessible without the currently required workarounds. Again, there is no precompiled, ready to use package of GIMP 2.7 for Mac. The software will have to be compiled using MacPorts using the steps below. GIMP 2.7 coupled with being compiled to use Quartz instead of X11 would be a very combination. Sure it won’t unseat Photoshop as the king of photo manipulation applications, but would give Mac users, like myself, a free alternative.

1. Go to http://www.macports.org
2. Follow the instructions for installing MacPorts, and Xcode tools
3. Follow the instructions for updating MacPorts
4. Run the following command: sudo port install gimp2-devel
5. Wait for the next 12-48 hours for MacPorts to download and compile the 195 support applications/libraries required to compile GIMP
6. Once the compilation and installation is complete, execute the following command to start GIMP: gimp

Arstechnica has a good article discussing the new single window interface available for GIMP as well as screenshots http://arstechnica.com/open-source/reviews/2010/02/hands-on-new-single-window-mode-makes-gimp-less-gimpy.ars.

*Note: I have been able to compile GIMP 2.7 on my PowerMac G4, but not start the. I am plagued with a “segmentation fault” error message.

Appendix

After I compiled GIMP I ran into the following error message, “Dynamic session lookup supported but failed. launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded”. Based on the comments made in the MacPorts bug tracker the solution is to restart the computer. If that doesn’t work then running the following command should resolve the problem

sudo launchctl load –w /Library/LaunchAgents/org.freedesktop.dbus-session.plist

While buildng GIMP 2.7 I also ran into an issue with compiling the support program ATLAS. The problem was caused by the fact my PowerMac G4 has an aftermarket processor and sometimes is mis-identified by applications. When ATLAS tried to configure the following error message was the result.

It appears you have CPU throttling enabled, which makes timings unreliable and an ATLAS install nonsensical. Aborting. See ATLAS/INSTALL.txt for further information

With the processor I have, the GigaDesigns PowerPC 7447 dual 1.8GHz CPU, there is no option to turn off CPU throttling. I doubt there is even a way to enable it. So instead I had to force ATLAS to ignore the error message, go ahead, and compile. This was the first time I ever had to do a custom build of MacPorts package. Here is what I did.

1. Created a new folder on my computer and named it “MacPortsFiles”
2. Found the portfile and custom files used to compile ATLAS from Macports: http://svn.macports.org/repository/macports/trunk/dports/math/atlas/
3. Downloaded all of the files and folder structure to the MacPortsFiles folder (example: /MacPortsFiles/math/atlas)
4. Edited the file /opt/local/etc/macports/sources.conf

a. Added the following line about the source list: file:///MacPortsFiles/

5. Ran the following command. touch /MacPortsFiles/math/atlas/portfile
6. Ran the following command. portindex
7. Edited the file /MacPortsFiles/math/atalas/portfile

a. Found the following block of text and added the flag -Si cputhrchk 0
Before:

if {[string equal "${os.arch}" "powerpc"]} {
configure.args-append -D c -DWALL
} else {
configure.args-append -D c -DPentiumCPS=${cpufreq}
}

After:

if {[string equal "${os.arch}" "powerpc"]} {
configure.args-append -D c -DWALL -Si cputhrchk 0
} else {
configure.args-append -D c -DPentiumCPS=${cpufreq} -Si cputhrchk 0
}

8. Compile GIMP again. It will pickup where the error occurred.

Have fun.

, , , , , , ,

  1. #1 by bashi - Sebastian Roethlisberger on March 30, 2011 - 4:50 am

    Pretty nice Overview. Managed to install 2.7, will try it now. X11 hack for 2.6 is great. Thanks man.

  2. #2 by Nicole on April 15, 2011 - 2:34 pm

    Hey, thanks for this. I really love GIMP, but when I moved from Windows to Mac, I hated having to use X11 to run the program in OSX. Wish that the official website for GIMP made it more immediately obvious that this can be run with Quartz, instead of just listing MacPorts as an alternate installation method :P. You are awesome!

    Currently setting up MacPorts as I type this. Yayyy~~!

    • #3 by Tony on April 21, 2011 - 10:00 pm

      Hi Nicole,

      I’m glad you found my information useful. I just got a new MacBook Pro and haven’t tried compiling the Quartz variant of GIMP on it yet. In the future I may look at trying to get 2.7 to run on Intel. If that works then building 2.7 with Quartz rendering would be my ideal setup.

(will not be published)