Page 1 of 1

How to extract specific color using command line

Posted: 2015-05-06T06:58:43-07:00
by ummaga
Hi.... I would like to extract only pointer(red) from the gauges image....
If we consider the below image for example how I can extract the pointer alone from the image?
Image

How to add mask(entire black) to the gauges background and extract the pointer alone?
Iam using 6.9.1-1 ImageMagick Commandline on windows platform.
Can someone help me?

Re: How to extract specific color using command line

Posted: 2015-05-06T10:24:44-07:00
by fmw42
try this -- adjust the fuzz value to suit. Unix syntax --- do not know if % needs to be %% in Windows.

Code: Select all

convert 14jc7f4.jpg -channel rgba -fuzz 20% -fill none +opaque red result.png

Re: How to extract specific color using command line

Posted: 2015-05-06T23:21:05-07:00
by ummaga
Thanks alot.. it works for the above pic... :D
Can I trim the edges along the pointer image to get the sharpen image...?

Re: How to extract specific color using command line

Posted: 2015-05-07T09:45:37-07:00
by fmw42
What does trimming have to do with sharpening? What is it that you want?

If you want to trim add just before the output image

-fuzz XX% -trim +repage

choose XX as desired

See
http://www.imagemagick.org/Usage/crop/#trim

Re: How to extract specific color using command line

Posted: 2015-05-09T00:26:49-07:00
by ummaga
hi I am sorry that I didnt make it clear.... when we do the fuzz we get pointer image ... we get boxes around the pointer image.... I want to eliminate that....

Re: How to extract specific color using command line

Posted: 2015-05-09T12:40:05-07:00
by fmw42
Did you try my command above