Page 1 of 1

Equivalent of clip-mask

Posted: 2019-05-01T06:29:21-07:00
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

Re: Equivalent of clip-mask

Posted: 2019-05-02T14:08:47-07:00
by dlemstra
image.Clip is the equivalent of -clip-mask in Magick.NET