Page 1 of 1

Using Mask with images

Posted: 2011-12-01T01:38:31-07:00
by MrsCalahan
Hi,

I try to create an Imagemask on this way: http://www.imagemagick.org/Usage/masking/#masks

The first step

Code: Select all

convert -size 100x100 xc:none -stroke black  -fill steelblue  -strokewidth 1 -draw "circle 60,60 35,35" -strokewidth 2 -draw "line 10,55 85,10" drawn.png
works

The second step

Code: Select all

convert drawn.png -alpha extract  mask.png
throws an error:
convert: UnrecognizedAlphaChannelType `extract'.
Does anybody know whats the problem?

Re: Using Mask with images

Posted: 2011-12-01T07:55:46-07:00
by el_supremo
That suggests that you are using an older version of IM which does not support "-alpha extract".
Which version are you using?

Pete

Re: Using Mask with images

Posted: 2011-12-01T10:39:38-07:00
by fmw42
on older systems, you can replace

convert image -alpha extract resultimage

with

convert image -channel a -separate +channel -negate resultimage

Re: Using Mask with images

Posted: 2011-12-06T01:19:55-07:00
by MrsCalahan
Hi,

yes it was an old IM Version. With the new Version ImageMagick 6.7.3-8 2011-11-23 Q16 -aplpah extract works.

I solved my problem like this:

Code: Select all

### creat a maske 
convert -size 100x100 xc:none -draw "circle 40,80 60,60" mask_shape.png

### use the mask on an image an create the result image
composite -compose Dst_Out -gravity center mask_shape.png  icon.png -alpha Set result.png 
Thanks for your help!