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
Post Reply
Posts: 2
Joined: 2013-02-20T16:37:00-07:00
Authentication code: 6789 alpha masking

Post by dlinaresg » 2017-09-12T09:48:16-07:00

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: 1360
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789

Re: alpha masking

Post by dlemstra » 2017-09-12T10:53:32-07:00

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

Post Reply