Wednesday, May 11, 2011

GIMP Color Range Mapping

[note: This first section was typed in early February]

I've been a fan of the GIMP (GNU Image Manipulation Program) for a looong time. It's helped me create and modify and fake many, many pictures over the years.

A while ago, one of its features vanished. The code behind it was a mess, and the developers didn't see its value. It would have been a pain to go through and make it work the way a modern GIMP plug-in should, so it (along with other stuff which richly deserved to get culled) was lost. Overall, GIMP got better, but a handful of people including myself really wanted our color range mapping back.

We had some tricks. An old binary of the plug-in would still load and run happily on newer versions of GIMP until pretty recently. But GIMP has moved on, and at this point, that crufty old plug-in just won't cut it.

Well, long story short:
https://bugzilla.gnome.org/show_bug.cgi?id=641893

I fixed up the code, and submitted a patch. With any luck, future versions of GIMP will include my refactor of that good ol' plug-in.

Here's what it does, if you're curious:


You define a pair of source colors (usually colors from your current image) and another pair of colors as a destination. All areas of the image that match your source colors get changed to your destination colors, and, most importantly, all colors that are in between your source color pair get translated as colors between your destination pair. It's very useful for altering images that have anti-aliasing baked in, or large patches of color with subtle-but-important variation.

...As you might see from the discussion on gnome.org, even the developers don't really understand why this is so great, so don't feel bad if you didn't follow all that. :^)

[note: the following section is from today]

I've given up trying to convince the developers to take my patch. Or even look at it, it sounds like. It's too bad, but anyone else like me who wants the feature back can apply my code and have it. I'm tempted to babble about some of the common things that open/free software gets wrong when dealing with its community, but they're largely known.

Probably, I should have brought it to them as "here's a new feature" instead of "this went away and I've revived it". Then I'd only have had to climb the shallower "not-invented-here" incline instead of the steeper "we already decided no" one. Either way I'd have still faced "why would you want to do that", which is particularly obnoxious and spans all of software (and many other areas, I'm sure).

Ahh well, live and learn. Or, just live. :^)

[update: 2011-08-19]
to patch against stable release code (as opposed to the latest from the git repository) give this a try:
http://penduin.net/projects/color-range-mapping-2.6.x.patch

[update: 2018-01-10]
If building from source is not your cup of tea, others have figured out another clever way of resurrecting this feature:
http://billauer.co.il/blog/2010/06/gimp-map-color-range-mapping-64-bit/
https://wtanaka.com/node/7904

Sunday, May 01, 2011

He's Dead

Holy crap. I've felt a lot of things upon hearing the news that someone has died, but this time, I feel like the world is lighter. Better.

http://www.npr.org/blogs/thetwo-way/2011/05/01/135905185/osama-bin-laden-is-dead-officials-say