gimp

The infamous PNG gamma/color correction problem

PNG images are great for Web work, but there's one problem that was really getting on my nerves: the color correction problem. PNG images, like many other formats, support embedded ICC profiles for color management. For websites this feature can become a big hassle since some Internet browsers (namely, Safari 3.x and up) will adjust the gamma and colors of images according to their embedded profiles, but the colors defined in CSS stylesheets are viewed with the native color profile. So if an image with an embedded ICC profile is used in combination with "background: " rules defined in a CSS stylesheet, the image will not match the background color of the page!

Fortunately, GIMP is capable of converting an image's embedded profile into the sRGB profile which was designed for use on the Internet.

First, GIMP requires a bit of setup:

  1. Select the color profile for your display by selecting Edit > Preferences from the menu and clicking on the Color Management section
  2. Set Mode of Operation to Color managed display
  3. From the Monitor Profile drop-down box, choose Select color profile from disk... and select the ICC profile which is you are currently using (tip: On OS X, ICC profiles are stored in /Library/ColorSync)

Once GIMP has been informed about which ICC profile your display is using, it can convert embedded profiles to the sRGB workspace:

  1. Open the image you want to convert
  2. Select Image > Mode > Assign from the menu and ensure that the sRGB profile is currently assigned
  3. Select Image > Mode > Convert from the menu and select the ICC profile that your display is using (the same one you chose in the setup sets)
  4. Save the image and if applicable, pass it through pngcrush to make it smaller
Rating: 

Installing GIMP on OS X

GIMP is a great program, but I always found it was a bit annoying to use on OS X (Leopard). First of all, whenever X11 starts, a new xterm window along with it. Besides that, when switching windows you need two clicks before GIMP (or any other program, really) registers the click and actually does something - the first click just switches the active window. Seeing as GIMP has it's tool palette in a separate window, this quickly became extremely irritating.

After a quick google, I found many sources saying that to disable xterm, I needed to copy /private/etc/X11/xinit/xinitrc to ~/.xinitrc and edit out the "xterm &" line inside. That's easy enough, but the only problem is that on Leopard with the latest X11 from XQuartz (2.3.2.1 at the time of writing) installed, /private/etc/X11/xinit/xinitrc doesn't exist! Although /usr/X11/lib/X11/xinit/xinitrc does, editing out all references to xterm doesn't work anyways. Instead, the app_to_run preference needs to be modified:

defaults write org.x.X11 app_to_run /usr/bin/true

/usr/bin/true is a command that does nothing (literally), so this essentially tells X11 to autostart nothing. I moved onto my next problem and found that to solve the two-clicks problem, the solution was to enable the "focus follows mouse" option like this:

defaults write org.x.x11 FocusFollowsMouse -string YES

I've been using that for a few months and I find it's still pretty annoying, but it's still less annoying than having to click twice on everything. Fortunately, I recently discovered the "wm_click_through" preference which is exactly what I had been looking for all along:

defaults write org.x.x11 FocusFollowsMouse -string NO
defaults write org.x.X11 wm_click_through -bool true

Now X11's window focus is back to normal, and clicking on inactive windows works as expected; it switches the window and activates the widget you clicked on. Problems solved!

Rating: