If you've ever looked at a picture and decided that it would look great with a different palette then you'll see where I'm coming from with this. Think about graphics resources you use in a game. Like a red brick wall. Now suppose you'd rather it was a yellow brick wall. Suppose furthur that you're not really a great artist, but you've got a whole bunch of great graphics resources for free (as in speech, if you mean to republish it).
You can easily move from one part of the colour spectrum to another with a hue rotation. The term comes from the measurement of colour hue in the Hue-Saturation-Value (or HSV) colour model. The hue measurement can be thought of as how far across the rainbow you're going. The colours of the rainbow are arranged in a circle, so the measurement is done in degrees. All a hue rotation does then is to change each replace each colour with the colour that's a given number of degrees away on that circle.
It's not hard to find the hue-stauration tool in the Gimp. It's on the Colour Tools Submenu of the Tools Menu. You can use the tool to do a hue rotation and adjust some other parameters for the selected part of the image. That part is pretty easy. If it was just one red brick wall texture then that's how I'd do it. Suppose that you have to do this operation a lot however. Suppose you have a bunch of red brick walls, maybe ten or twenty variations of the same wall - to keep the game interesting. Now that's not a huge amount of work to do once, but it can be enough to slow a developer down or tempt them to skip it and just use the pictures as they are. That's the point when I decide I need to do a little automation. For a little project like this I want to reduce the chance of making a mistake on one or two graphics and also I want to speed it up from 30 seconds each to 10 seconds each.
Anyway, whining aside, I've finally got a simple script to work in the Gimp that helps in the situation described above. The central function that I want to use is gimp-hue-saturation. I experimented by bringning up the SIOD command line interpreter and trying some commands. You can call this function directly from the Scheme command line interpreter. Get the interpreter window from the menu "Xtns ⇒ Script-Fu ⇒ Script-Fu Console". Then try these commands:
Enter these lines into the SIOD command line one at a time. The only change you need to make is the '1' in the first line. Each image editing window in the Gimp has a number after the title (like 1.0, 2.0 or 17.0). The number increments for each image you have opened. The number is used to access that image in scripts and plugins, kind of like a file handle. So what the three lines in my simple example above do could be rewritten in a non-functional pseudocode as follows:
In the interest of brevity (this has gone on way longer than I thought it would), here's the rest of my simple script:
This script defines a function script-fu-hue-rotate which takes a parameter image(of course this is the image number as described earlier). If you copy all this and paste it into SIOD, you'll be able to call the function from the console for each of your images. There are other ways to accelerate this further with the Gimp's batch processing mode. Another choice is to register the function on the Script-Fu menu. There are lots of places that explain how to register this function on a menu like other Script-Fu tools. I might come back to this one day and explain it as well, but not right now.
One more caveat: this won't work as-is with an indexed palette such as those in a GIF image. For that you'll need to call (gimp-image-convert-rgb image) before doing the hue rotation, and (gimp-image-convert-indexed image 0 0 256 0 0 "") (or some variation - and watch those quotes when copying and pasting) to convert it back.
I hope I've clarified scripting the Gimp more than I've confused it for you. Good luck.