Equivalent of clip-mask

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
bredstrup
Posts: 1
Joined: 2019-05-01T06:22:54-07:00
Authentication code: 1152

Equivalent of clip-mask

Post by bredstrup »

Hello,

sorry, I am very new to ImageMagick. I have this command line arguments, that I need to convert to .NET / c#:

-define psd:alpha-unblend=off -trim "inout image" -clip-mask -resize 1600> "outputimage"

I've got this so far:

var setting = new MagickReadSettings { Defines = new PsdReadDefines { AlphaUnblend = false } };
using (var image = new MagickImage(file, setting))
{
image.Trim();
image.Resize(new MagickGeometry { Greater = true, Width = _maxSize, Height = _maxSize });
return image.ToByteArray(MagickFormat.Png);
}

I do not know how to get -clip-mask into c#. Using the above code works, but produces a PNG with a "black" background in some image viewers. Using Image Magick with the native commandline args above does not yield this black background.

I am very thankful for any help.

Best,
Anders Pedersen
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Equivalent of clip-mask

Post by dlemstra »

image.Clip is the equivalent of -clip-mask in Magick.NET
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply