alpha masking

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Posts: 6
Joined: 2013-02-20T16:37:00-07:00
Authentication code: 6789 alpha masking

Post 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

User avatar
Posts: 1625
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789

Re: alpha masking

Post 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);
.NET + ImageMagick = Magick.NET, @MagickNET, Donate