[Closed] Rotating images before using image.Composite

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
i73
Posts: 42
Joined: 2016-08-24T11:30:27-07:00
Authentication code: 1151

[Closed] Rotating images before using image.Composite

Post by i73 » 2017-08-08T13:39:23-07:00

Hello, I am trying to rotate some images before calling Composite on them (I am adding 6 images to a single image) wondering how best to do this, seeing how I am not having any luck:

I've tried the following:

Code: Select all

      
      //This does not rotate, I even tried writing the image right after. 
      MagickImage image = new MagickImage("MyImagePath");
      image.Rotate(rotation);

Code: Select all

     //This does not work either with the -rotate argument.
     image2.Composite(image, image.Width * x, image.Height * y, new CompositeOperator(), $"-rotate {rotation}");
Last edited by i73 on 2017-08-08T14:09:30-07:00, edited 1 time in total.

i73
Posts: 42
Joined: 2016-08-24T11:30:27-07:00
Authentication code: 1151

Re: Rotating images before using image.Composite

Post by i73 » 2017-08-08T14:09:17-07:00

For some reason rotate was not working with my original image, but now it is.. Thanks guys.

pablobhz
Posts: 51
Joined: 2016-05-07T06:47:14-07:00
Authentication code: 1151

Re: [Closed] Rotating images before using image.Composite

Post by pablobhz » 2017-08-14T10:02:27-07:00

You need to store the rotated image somewhere

i.e:
MagickImage mysampleImage = new MagickImage(filePath);
mysampleImage = mysampleImage.Rotate(90);
mysampleImage.Write(@"C:\TEST\rotatedimage.png");

If you're working with multiple images (you said 6), why don't you create a List<MagickImage> or an MagickImageCollection, store them all there and then do your operations ; would be easier i think.

Just leaving my input :)

Bye !

Post Reply