I'm trying to achieve some transformations on images using Magick.NET and I got some useful help by getting the right command-line:
Code: Select all
magick C:\Users\gm\Desktop\Vader.jpg -resize 1280x1920^^ -gravity center -crop 1280x1920+0+0 +repage C:\Users\gm\Desktop\Vader.jpg
The problem is that I'm not being able to map it and get the same result using Magick.NET.
The code I currently have is the following (the original image size is 2732 x 2732 and the resulting image form my code has 1280x1280 rather than 1280x1920):
Code: Select all
using (MagickImage image = new MagickImage(ssimageBinary))
{
image.Density = new Density(sstargetDensity);
MagickGeometry size = new MagickGeometry(sstargetWidth, sstargetHeight);
image.Resize(size);
image.Crop(sstargetWidth, sstargetHeight, Gravity.Center);
image.RePage();
// Save the result and return it has binary data
MemoryStream mStream = new MemoryStream();
image.Write(mStream, MagickFormat.Png);
ssnewImage = mStream.ToArray();
}
Cheers