Page 1 of 1

HUE: Converting .gif logo color to specified RGB value

Posted: 2008-11-18T17:21:48-07:00
by ricardo_mano
I would like to be able to convert a logo for a website (e.g. help icon) to a different color, specified on input. I am able to gain the desired effect using the '-modulate' operator, but the outcome is determined as a rotation of color values.

Basic example: the current logo color is green, and the user decides it should be purple. The user enters purple, along with the logo. The result is a new logo which is now purple.

I have thought about using masks and transparency, and changing the original image to black and white. Is this a good route to explore, or is there an easier method?

Thankyou for your help.

Re: HUE: Converting .gif logo color to specified RGB value

Posted: 2008-11-18T17:36:46-07:00
by anthony
convert the logo to a greyscale version. then use -tint (set grey colors) or +level-colors (set black/white gradient) to color the image to ANY color by name or value!

See IM Examples, Color Modifications

Level Adjustment by Color
http://www.imagemagick.org/Usage/color/#level-colors

Midtone Color Tinting
http://www.imagemagick.org/Usage/color/#tint

Re: HUE: Converting .gif logo color to specified RGB value

Posted: 2008-11-18T17:38:54-07:00
by ricardo_mano
Thanks for that Anthony, I'll take a closer look at those operators.

Re: HUE: Converting .gif logo color to specified RGB value

Posted: 2008-11-18T18:20:11-07:00
by ricardo_mano
anthony wrote:convert the logo to a greyscale version. then use -tint (set grey colors) or +level-colors (set black/white gradient) to color the image to ANY color by name or value!

See IM Examples, Color Modifications

Level Adjustment by Color
http://www.imagemagick.org/Usage/color/#level-colors

Midtone Color Tinting
http://www.imagemagick.org/Usage/color/#tint
I've had a quick go at manipulating the .gif by the above method and it seems that not enough of the 'secondary' colour are preserved. i.e I want to define the main color, not the entire icon (see the handle in the example below). Having said that, It wouldn't matter too much, but I would need to get the result a little darker - with more contrast.

Here is an example of the different methods.

The input image.

Image

Conversion using hue offset of 10 (-modulate 100,100,10)

Image

Conversion using the above method (grayscale then recoloring)

Image

Just thought I'd give some feedback.. and to see if anyone has any other suggestions. I will look into the documentation more tomorrow for inspiration, but for now it's very late (UK time). Thanks again for any help.

Re: HUE: Converting .gif logo color to specified RGB value

Posted: 2008-11-18T22:53:54-07:00
by anthony
For this image you woyld make sure the circle and the magnifying glass is black, You can then use -tint to tint the grey parts.

However I agree modulate would probably be the better method for the image in question.

NOTE 100,100,100 is NO change.