Change a single range and the rest black
Change a single range and the rest black
I am trying to take an image, make ALL of it black, except for a specific color range (of DarkOliveGreen) but not having luck
The image has alpha (PNG alpha, not an actual Alpha channel), which I want to also make go away.
convert imageIn.png -fuzz 7.5% -fill white -opaque DarkOliveGreen PNG24:imageOut.png
How do I select everything EXCEPT the above color range and make it black?
The image has alpha (PNG alpha, not an actual Alpha channel), which I want to also make go away.
convert imageIn.png -fuzz 7.5% -fill white -opaque DarkOliveGreen PNG24:imageOut.png
How do I select everything EXCEPT the above color range and make it black?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Change a single range and the rest black
Code: Select all
convert imageIn.png -alpha off -fuzz 7.5% -fill white -opaque DarkOliveGreen \
-fuzz 0 -fill black +opaque white PNG24:imageOut.png
http://www.imagemagick.org/script/comma ... php#opaque
"Use +opaque to paint any pixel that does not match the target color."
P.S. Please always provide your IM version and platform when asking questions. See viewtopic.php?f=1&t=9620
Re: Change a single range and the rest black
Thank you very much!
Absolutely...sorry about that.... 6.9.2-4 Q8 x64 windows 7 Profmw42 wrote:P.S. Please always provide your IM version and platform when asking questions. See viewtopic.php?f=1&t=9620
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Change a single range and the rest black
You do not say what your platform is. IM syntax differs on Windows and Unix
Re: Change a single range and the rest black
That yields an entirely black image.fmw42 wrote:Code: Select all
convert imageIn.png -alpha off -fuzz 7.5% -fill white -opaque DarkOliveGreen \ -fuzz 0 -fill black +opaque white PNG24:imageOut.png
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Change a single range and the rest black
Are you on Windows or Unix? If Windows, then try
Otherwise, please post your image to some place such as dropbox.com and put the URL here, so we can test with it.
Code: Select all
convert imageIn.png -alpha off -fuzz 7.5% -fill white -opaque DarkOliveGreen ^
-fuzz 0 -fill black +opaque white PNG24:imageOut.png
Re: Change a single range and the rest black
It is Windows...(I had previously edited my post to include that) and I am using command line batch (cmd) files...(yes I remembered to use %% this time )
Thanks! I am still getting the hang of all that this amazing program can do, but more importantly, HOW to get there...
Thanks! I am still getting the hang of all that this amazing program can do, but more importantly, HOW to get there...
fmw42 wrote:Are you on Windows or Unix? If Windows, then try
Otherwise, please post your image to some place such as dropbox.com and put the URL here, so we can test with it.Code: Select all
convert imageIn.png -alpha off -fuzz 7.5% -fill white -opaque DarkOliveGreen ^ -fuzz 0 -fill black +opaque white PNG24:imageOut.png
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Change a single range and the rest black
For new users, see
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/script/comma ... ptions.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
And don't be shy about asking questions on the forum.
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/script/comma ... ptions.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
And don't be shy about asking questions on the forum.
Re: Change a single range and the rest black
In the end, this worked:
convert ImageIn.png -alpha remove -fuzz 7.5%% -fill black +opaque DarkOliveGreen -fill white -opaque DarkOliveGreen PNG24:ImageOut.png
So that very much helped me figure it out...thanks!
This gives me an entirely black image except where I had green, and then turns that to white....perfect!
convert ImageIn.png -alpha remove -fuzz 7.5%% -fill black +opaque DarkOliveGreen -fill white -opaque DarkOliveGreen PNG24:ImageOut.png
So that very much helped me figure it out...thanks!
This gives me an entirely black image except where I had green, and then turns that to white....perfect!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Change a single range and the rest black
That is why one needs to provide the platform you use each time, so that we can provide the correct syntax. Also in bat files you do need to double the % to %%. For normal terminal commands and bat files, you need to use ^ for new line markers and and when using percents do not escape with \. See http://www.imagemagick.org/Usage/windows/