Converting colored areas to b/w hatchings with outline

BPJ <[email protected]> Mon, 18 Apr 2011 14:15:45 +0200
Newsgroups gmane.comp.video.image-magick.user
Message-ID <[email protected]>
I have a set of images using up to four different colors
contrastively in addition to a white/transparent background
and some black areas/text, and need to convert these to b/w
versions with each color replaced by a hatch/dot pattern,
and preferably with each hatched area outlined with a thin
black border. I know how to replace a color by another color
from the command line but not how to replace a color with a
pattern. However I'm totally at a loss on how to achieve a
black outline around a colored area.  Additionally I'd like
to do this in a perl script.

TIA,

/bpj