Simple to explain: possibly not so simple to do.

In Gimp, I have a green button GIF image: it shades from dark green to light green, against a transparent background.

I would like to change it to blue, and keep the shading, so it shades from dark blue to light blue.

Anyone know how I can do this? Can't find an explanation by Googling!

Thanks.

link|improve this question
feedback

migrated from stackoverflow.com Jun 16 '10 at 15:29

This question came from our site for professional and enthusiast programmers.

5 Answers

You're looking for the Color-Menu, and especially the function 'Colorize'.

link|improve this answer
feedback

I suggest rotating Hue in ColorsHue-Saturation.

Given an initial image like this:

green gradient

You change Hue first and then adjust Brightness and Constrast to your liking.

Adjust Hue in Colors -> Hue-Saturation

The result looks like this:

blue gradient

You can easily make it colder or warmer, darker or lighter, more or less saturated.

link|improve this answer
feedback

On simple small graphics, what I do is Zoom in a lot, then change the colors myself using the brush.

Just change the brush size to 1 pixel.

link|improve this answer
-1 That's not practical if there is a gradient, you'd have to change dozens of different colors. – sleske Mar 30 at 9:38
feedback

I don't know how to do it in gimp, but ImageMagick has functions to separate and combine color channels. See this page.

I was able to convert a green gif to blue with this command:

convert input.gif -separate -swap 1,2 -combine output.gif

I guess that 1 and 2 refer to green and blue channels, 0 is red.

link|improve this answer
feedback

The first successful method I found to do the same sort of thing was to use ImageMagick, but with a different operator than the earlier-suggested --separate/-swap.

The different operator is either -recolor or -color-matrix, depending on ImageMagick version.

Specifically, because I knew a "master color" of the original image (green, in your case and mine) and I knew the "master color" in the desired result image (blue, in your case, orange in mine), I gave ImageMagick' -recolor/-color-matrix option a transformation matrix with values that reflected the differences in each of the RGB channels.

For example, in my case, the fully green color was R:141 G:198 B:63 and I wanted it changed to R:231 G:159 B:70. The rest of the colors wanted to be changed equivalently.

So that means I wanted new pixels' R value to be 231/141ths of the current red value. Green values to be 159/198th of the current values. And blue values to be 63/70ths of the current values.

So:

convert input.png -recolor      "1.638297872 0 0    0 0.803030303 0   0 0 1.111111111" output.png

or

convert input.png -color-matrix "1.638297872 0 0    0 0.803030303 0   0 0 1.111111111" output.png

or

This seemed to work in a flash after fruitlessly spending a lot of time wrestling with Gimp/plugins and paint.net/plugins.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown