This project has moved and is read-only. For the latest updates, please go here.

Applying rotation, scale and translation to images

Mar 6, 2016 at 7:21 PM
Are there any examples out there on how to use MagickImage.Transform? I'm trying something simple, but not having much luck ...

MagickImage image = new MagickImage(imageFIle);

image.Settings.SetTransformOrigin(0, 0);
image.Settings.SetTransformRotation(0);
image.Settings.SetTransformScale(2, 2);
image.Settings.SetTransformSkewX(0);
image.Settings.SetTransformSkewY(0);

MagickGeometry geo = new MagickGeometry(image.Width, image.Height);
image.Transform(geo, geo);

image.Write(imageFIle);
Mar 6, 2016 at 10:03 PM
Edited Mar 6, 2016 at 10:08 PM
Those settings are used by annotate so this is probably not what you want. And after taking a look at the method that is called by Transform I decided to remove that method in the next release of Magick.NET.

I am not sure what you want but you can find a lot of ImageMagick examples here: http://www.imagemagick.org/Usage/. Can you explain in more detail what you are trying to accomplish?
Mar 7, 2016 at 2:30 AM
Okay, good to know. I'm trying to scale, rotate and translate an image onto another (much larger image). It's just a basic affine transform where the result is composed with another image. I've played around with the command line version of IM and I think I can make that work, but I want it to work in Magick.net (which I absolutely love) since this is part of a C# app.
Mar 7, 2016 at 5:53 PM
I think you are looking for the AffineTransform method of MagickImage. Can you give that a try and let me know if that works for you?