Hello Community
I have a base image that looks like that
Orig
I need to change the color of this arrow based on a selection from a color picker.
Basicly i tried this with Photoshop and the result looks like this. I used a simple color overlay with RGB(255,0,0)
Result
My goals is to do this with IM so i looked up the tinting samples which uses -colorize. But -colorize just blends the image with a fill color rather than overlay the base with the new color. I don't know how to get this work that it looks like in Photoshop.
How to replace color with another
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to replace color with another
try -modulate
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to replace color with another
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: How to replace color with another
Thx
I looked at the samples. But how can i modulate my image to an exactly value in RGB like
R:101 G:237: B159. Playing with the HUE value from 0 to 360 gives only 360 possible colors. I don't understand how this exactly works. I am a really noob to graphics.
I looked at the samples. But how can i modulate my image to an exactly value in RGB like
R:101 G:237: B159. Playing with the HUE value from 0 to 360 gives only 360 possible colors. I don't understand how this exactly works. I am a really noob to graphics.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to replace color with another
you will have to convert RGB colors to HSL or HSB colors. There are many online tools that will do that for you. You provide the RGB and it tells you the HSL or HSB. See for example:
http://serennu.com/colour/hsltorgb.php
http://web.forret.com/tools/color.asp
You can do a Google search and probably find others or even tools to download. For example many imaging tools like photoshop, etc have these built in.
Also note that in IM, you can provide floating point values to -modulate.
http://serennu.com/colour/hsltorgb.php
http://web.forret.com/tools/color.asp
You can do a Google search and probably find others or even tools to download. For example many imaging tools like photoshop, etc have these built in.
Also note that in IM, you can provide floating point values to -modulate.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to replace color with another
The number is floating point, not integer! and it goes from 0 to 200 (the results is the same for those two values) with a value of 100 for no change.NyzeAustria wrote:Thx
Playing with the HUE value from 0 to 360 gives only 360 possible colors. I don't understand how this exactly works. I am a really noob to graphics.
Read the 'Usage Guide' link!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to replace color with another
Another way is to convert the image provided to a grayscale!
You can then tint that grayscale so that anything that was pure 50% gray becomes the exact color specified using -fill {color} -tint 100
See 'Tint' on the same IM Examples page
http://www.imagemagick.org/Usage/color/#tint
Hmmm looking at the operator again, it seems I was wrong, pure grays do not become the exact color! I will need to study this further, and either get that fixed, or find out what it really is going.
In the mean time their are DIY alternatives.
You can then tint that grayscale so that anything that was pure 50% gray becomes the exact color specified using -fill {color} -tint 100
See 'Tint' on the same IM Examples page
http://www.imagemagick.org/Usage/color/#tint
Hmmm looking at the operator again, it seems I was wrong, pure grays do not become the exact color! I will need to study this further, and either get that fixed, or find out what it really is going.
In the mean time their are DIY alternatives.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: How to replace color with another
Is there still no solution for this? Don't know how to get this work!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to replace color with another
I believe we have given you many solutions. If we have misunderstood your problem, please clarify with examples of what you have and what you need. It does not have to be the same solution as PS, but simply get you the same kind of results.
The easiest way is
convert image -colorspace gray +level-colors color1,color2 output
see
http://www.imagemagick.org/Usage/color/#level-colors
http://www.imagemagick.org/Usage/color/#tinting
The easiest way is
convert image -colorspace gray +level-colors color1,color2 output
see
http://www.imagemagick.org/Usage/color/#level-colors
http://www.imagemagick.org/Usage/color/#tinting