This project has moved. For the latest updates, please go here.

how to use distort:viewport with Magick.net

May 31, 2015 at 9:25 AM
Hi,
I'm trying to call a command like this using Magic.net:
convert 6922044.jpg -define distort:viewport=694x720-369+791 -distort ScaleRotateTranslate "0,0  1,1  30" +repage converted.jpg
I couldn't find a way to set the viewport. Is there?

Thanks
Ziv
Coordinator
May 31, 2015 at 10:13 AM
You need to set it with SetArtifact:
using (MagickImage image = new MagickImage("6922044.jpg"))
{
  image.SetArtifact("distort:viewport", "694x720-369+791");
  image.Distort(DistortMethod.ScaleRotateTranslate, new double[] { 0, 0, 1, 1, 30 });
  image.RePage();
  image.Write("converted.jpg");
}