Page 1 of 1

Filter RGB Colors

Posted: 2014-04-05T11:42:40-07:00
by TPMarketing
I want to make all pixels of a certain #RGB white/black in an image or the inverse rendering all other pixels black. What is the best way to achieve that?

for example I want the image to only show pixels with RGB value of #002865

Thanks

_____________

website

Re: Filter RGB Colors

Posted: 2014-04-05T11:49:35-07:00
by fmw42

Code: Select all

convert image -fuzz XX% -fill "#002865" +opaque black result
where XX=0 (or remove -fuxx XX%) if you want a perfect match to #002865.

If you want to change #002865 to white and the rest black, then

Code: Select all

convert image -fuzz XX% -fill "#002865" -opaque white +opaque black result
see
http://www.imagemagick.org/Usage/color_basics/#replace