Replace color in a gif using imagemagick or GIMP
I'll start out with a disclaimer. I hate GIMP, I absolutely truly do. I love Paint.NET. I love Krita. I hate GIMP. It's as simple as that. Take a look at The Design of Everyday Things for reasons as to why GIMP sucks. One cannot define the conceptual model for it. It is not apparent how to use. This complex design drives users away in droves. The first part will be how we do this in GIMP and then the second part how we do this using ImageMagick.
That said, unfortunately Krita doesn't have gif support and I can't use Paint.NET on my Ubuntu box. At least not without a lot of extra effort and software. So, back to GIMP it is.
So we have a GIF with a transparent background, some text, some other assorted colors. We want to replace the color of the text. Simple, from the menu choose Select -> By Color. Then click on the text of the color you are replacing. Then, click on the fill button (the paint bucket), select a color, and fill that text back in. Sounds simple right?
Well no, actually. What if your color is not available, say you need some fancy gold color. Ok well you can add it in the fill color dialog, using the HEX or RGB values. Great! Now, you got to paste the color in. But wait! That's not the color I chose! What's going on here? What's happening is, the color doesn't actually exist in the palette so GIMP is choosing the next closest color available. Too bad it couldn't let us know that. How can we get the color we want. Well you need the palette dialog. What can't find the palette dialog? Well, perhaps you went to the GIMP docs. However, make sure you go to the right version of the docs, cause of course how to get to the dialog has changed, cause GIMP likes to changed the interface on users, often. Open the dialog using Windows → Dockable Dialogs → Palettes; From there you can then edit the dialog to add a color for the magic gold you want, say e2af2d. You can choose any spot 1-255 for it, I just put it in 255 over the white and it seemed to work ok. Finally, save your image and there you have it.
We could also try this using ImageMagick on the command line if we have it installed. Try "convert" on your command line. If it is installed you will get a list of options. Using the convert command we can do neat things like "convert image.png image.gif" and then we have converted a gif to a png simply and quickly. Granted, you have to worry about alpha channels and transparency in some cases, but you get the idea. Now, if we want to replace a color we can do something like "convert image.gif -fill "#eeeeee" -opaque "#e2af2d" image2.gif" Now, unfortunately, since the color isn't in the palette this still won't work out to great for us if don't have the color in the palette so you will still need to do that with GIMP unless you know the command to do it. I suspect this post this post may hold the key, but I haven't figured it out yet. Hope that helps someone out there trying to convert colors in a gif.