| Hi,
| 
| I need to make transparent some zones in an image but not others that have 
| the same color. For example if I take logo: image (the ImageMagick wizard), 
| I want to turn transparent all white zones but not the white beard.
| 
| In other words, I want to make transparent the background of an image but 
| not the inner zones that have same color as background is.
| 
| I try to use Masking Simple Backgrounds (floodfill) example from Anthony 
| Thyssen's example page http://www.imagemagick.org/Usage/channels/
| 
| Below the DOS script:
| convert logo: ( +clone -fx "p{0,0}" ) -compose 
| ifference  -composite  -modulate 100,0  +matte  difference.png
| 
A faster way is to -crop 1x1+0+0 and then use that to tile the original
image!

   convert logo: \( +clone -crop 1x1+0+0 -write mpr:bg +delete \) \
           \( +clone -tile mpr:bg -draw 'color 0,0 reset' \) \
           -compose difference -composite +matte difference.png

| convert difference.png  -threshold 0  boolean_mask.png
| 
| convert logo:  boolean_mask.png +matte -compose CopyOpacity -composite 
| logo_boolean.png
| 
| but the beard turn transparent...!
| 
I suggest you look further down to the method for removing the background
where floodfills are used on the difference image to generate a mask
of what is 'inside' and what is 'outside' an image.

basically you don't -threshold the difference image, but flood fill to
generate the mask.



  Anthony Thyssen ( System Programmer )    <[email protected]>
 -----------------------------------------------------------------------------
  What are the facts? Again and again and again  -- what are the _facts_?
  Shun wishful thinking, ignore divine revelation, forget what 'the stars
  foretell', avoid opinion, care not what the neighbors think, never mind
  the unguessable 'verdict of history', -- what are the facts, and to how
  many decimal places? You pilot always into an unknown future; facts are
  your only clue. Get the facts!  -- Lazuras Long, (Aka. Robert Heinlein)
 -----------------------------------------------------------------------------
     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

Reply via email to