Here is one example:
convert \ http://i.stack.imgur.com/rK259.png \ -fuzz 33% \ -fill black \ -opaque "#A87830" \ -threshold 12% \ black+white.png
The -fuzz matches all colors that are in a certain proximity to the color specified by -opaque . No -fuzz , and you will only match those pixels that exactly match "#A87830" .
-threshold converts color pixels to black or white, where the percentage determines the limit: above it becomes black, below it becomes white.

You can change the command from -opaque "<color-definition>" to +opaque "<color-definition>" to invert the color selection value: it will replace pixels that are NOT this color (this time I skipped the -threshold option to save flowers):
convert \ http://i.stack.imgur.com/rK259.png \ -fuzz 33% \ -fill black \ +opaque "#FFFFFF" \ other.png

source share