Page 1 of 1
Keep only one color [color-spotting]
Posted: 2006-07-24T12:44:49-07:00
by dognose
I'm wondering if there is an easy way in IM to do something like this:
http://k47.pbase.com/u16/shaun/upload/2 ... eyes_r.jpg
Assuming the eyes were blue in an original color picture..
how could I remove all the other colors, but keep the blue?
I know about seeing the RGB channels of the image, but this seems different.
One way would be to select a color in the image +/- a fuzz, and convert everything else to grayscale.
Or, would there be a way to use a color map that only had blue and grayscale?
Any ideas on how to do this? I've gotten a lot of requests to do this type of effect.
Posted: 2006-07-24T20:57:08-07:00
by anthony
One way I can think of, is to chnage all the blue colors (with a fuzz) to some other color, then compare the result with the original image. Every pixel that changed can then be used as a mask to extact all the blue pixels from the original image.
You can even trim down the resulting image using a fuzzy trim to remove the
small inconsequental spots of blues outside the main area.
NOTE your example image is NOT appearing.
Posted: 2006-07-26T10:13:05-07:00
by dognose
Hmm,
Sorry, the site didn't allow direct linking I guess. If you copy and paste the url, it should work.
How would I "change all the blue colors, with a fuzz" ? If I can match all those colors and do a transformation, wouldn't it be easier to act on the other colors?
Is there a way to extract the color map from my example image and map that to a new image? Would come out as desired?
Posted: 2006-07-26T21:08:30-07:00
by dognose
Oh, just updated the original message... The effect in photoshop is callled "color-spotting"
Posted: 2006-07-27T01:52:18-07:00
by anthony
Hmm ok download the 'colorwheel' image
http://localhost/~anthony/graphics/imag ... rwheel.jpg
Now lets try to get all colors that are withing 30% spherical RGB distance to blue and make everything else transparent..
Code: Select all
convert colorwheel.jpg -matte \
\( +clone -fuzz 30% -transparent blue \) \
-compose DstOut -composite all_blue_colors.png
This copys the original image (adding an alpha/matte channel) and creates a mask of all the colors that was not blue, by trunign blue colors transparent. It then uses that image to find all the pixels that was not 'in' (eg teh destination pixels 'outside' the source image). That is the not-not-blue pixels.
http://www.cit.gu.edu.au/~anthony/graph ... olor/#fuzz
The result is a image of all the blue-like colors, to the amount specified by the -fuzz factor.
I have added this example to the 'fuzz factor' section of 'Colors' in IM examples.
Posted: 2006-07-27T06:44:49-07:00
by dognose
Wow, that works perfectly. Thanks!