Page 1 of 1 alpha masking

Posted: 2017-09-12T09:48:16-07:00
by dlinaresg
I want to apply an alpha mask onto a picture, just as in this post: viewtopic.php?t=30488. But I can't figure how can I translate the command from Imagemagick to

Code: Select all

convert 3-sample.png -alpha on -background none ^
   ( +clone -channel a -evaluate multiply 0 +channel -fill white -draw "ellipse 153,128 57,57 0,360" ) ^
   -compose DstIn -composite circle_in.png
I can create the image, clone it and apply alpha:

Code: Select all

 using (MagickImage image = new MagickImage(filePath))
                IMagickImage clone = image.Clone();                
But don't know how to code "-evaluate multiply 0".

Thank you

Re: alpha masking

Posted: 2017-09-12T10:53:32-07:00
by dlemstra
Most commands have are available as a method on the IMagickImage interface. Evaluate works like this:

Code: Select all

using (IMagickImage clone = image.Clone())
    // -channel a -evaluate multiply 0 +channel
    background.Evaluate(Channels.Alpha, EvaluateOperator.Multiply, 0);