Extract mask from specific color from some point
Posted: 2007-12-27T13:52:35-07:00
First of all, thank all of you, in special Anthony, for the documentation. It's great and easy to follow.
I'm trying to extract a mask from picture, based on some specific color from some point.
source pic:
what I need to get when I use the command with x=200 & y=700 (yellow pixel at his right feet):
I think that the line I'm using can explain a lot better what I'm trying to achieve:
With the above code I can get an get a transparent canvas with a white "mask". But what I really need is a mask, ie, the image must have a black background instead of a transparent one.
So I appended a extra +matte to the end of the command, but it didn't work. Then I tried this:
And it worked as expected! So I tried to use the pipe thing, so I don't need to create an extra temp file:
And this didn't work =/
What I'm missing? Or is there a more straightforward way to do the whole thing?
Thanks in advance,
Tiago
I'm trying to extract a mask from picture, based on some specific color from some point.
source pic:
what I need to get when I use the command with x=200 & y=700 (yellow pixel at his right feet):
I think that the line I'm using can explain a lot better what I'm trying to achieve:
Code: Select all
convert $pic \( +clone -fill white -fuzz $fuzz% -draw 'color $x,$y replace' \) +swap -compose ChangeMask -composite $mask"
So I appended a extra +matte to the end of the command, but it didn't work. Then I tried this:
Code: Select all
convert $mask +matte test.gif
Code: Select all
convert $pic \( +clone -fill white -fuzz $fuzz% -draw 'color $x,$y replace' \) +swap -compose ChangeMask -composite miff:- | convert - +matte $mask
What I'm missing? Or is there a more straightforward way to do the whole thing?
Thanks in advance,
Tiago