On Fri, 24 Jul 2009 20:06:14 +1000 (EST) "damien dunlop" <[email protected]> wrote:
| Response to `Extract one colour' | | | Suppose a multi-coloured RGB image contains areas of | | a certain RGB value (within a small tolerance). | | | | Using ImageMagick, is it possible to change all other colours | | to a background colour, leaving the image with just the specified | | colour and the background colour. | | | | >> | >> -fill white +opaque red | >> | >> that will replace anything not pure red to white | >> Add a -fuzz factor if you want 'near pure red'. | >> | >> -fuzz XX% -fill backgroundcolor +opaque yourcolor | | Thanks to Fred and Anthony for the response above, it works! | | But to take it further, I want to | | a) Extract certain colours from a multi coloured image and | then combine the extracted areas in a composite image, with all | other colours changed to a background colour. | | b) The same as a) but creating individual images (which may | be inspected and modified a little as individual images) | then combining the lot to achieve a composite image as in a). | | I did try various command combinations but always ended up with | the final image consisting of only the background. | | Damien | See http://www.imagemagick.org/Usage/color/#fuzz Look for the example the produces a flower like image... convert colorwheel.png -channel A \ -fuzz 25000 -transparent blue -transparent red -transparent lime \ -fuzz 11000 -transparent black -negate +channel \ -background white -flatten opaque_multi_inv.png This uses a trick that first makes the selected color transparent But only sets the transparency, it does not change the color itself. Then it negates the transparency so that the colors you were making transparent, actually ends up opaque! and the unselected colors ended up transparent. I then flatten a white background underneath. Basically it is exactly what you are wanting!!!! Anthony Thyssen ( System Programmer ) <[email protected]> ----------------------------------------------------------------------------- "Oh, the pain... the pain of it all!" -- Doctor Smith, Lost in Space ----------------------------------------------------------------------------- Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/ _______________________________________________ Magick-users mailing list [email protected] http://studio.imagemagick.org/mailman/listinfo/magick-users
