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.
HUE: Converting .gif logo color to specified RGB value
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: HUE: Converting .gif logo color to specified RGB value
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
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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: HUE: Converting .gif logo color to specified RGB value
Thanks for that Anthony, I'll take a closer look at those operators.
Re: HUE: Converting .gif logo color to specified RGB value
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.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
Here is an example of the different methods.
The input image.
Conversion using hue offset of 10 (-modulate 100,100,10)
Conversion using the above method (grayscale then recoloring)
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.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: HUE: Converting .gif logo color to specified RGB value
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.
However I agree modulate would probably be the better method for the image in question.
NOTE 100,100,100 is NO change.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/