How to extract specific color using command line

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
ummaga
Posts: 8
Joined: 2015-03-03T04:37:31-07:00
Authentication code: 6789

How to extract specific color using command line

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to extract specific color using command line

Post 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
ummaga
Posts: 8
Joined: 2015-03-03T04:37:31-07:00
Authentication code: 6789

Re: How to extract specific color using command line

Post 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...?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to extract specific color using command line

Post 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
ummaga
Posts: 8
Joined: 2015-03-03T04:37:31-07:00
Authentication code: 6789

Re: How to extract specific color using command line

Post 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....
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to extract specific color using command line

Post by fmw42 »

Did you try my command above
Post Reply