rotate image 0 to 360

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

A good solution would be to write a script to rotate the image. A shell script or Perl script would be a good place to start.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

For an example see the animate rottaion creation script in IM examples
http://www.cit.gu.edu.au/~anthony/graph ... animations

EG: http://www.cit.gu.edu.au/~anthony/graph ... ate_rotate
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo »

I have done a simple example in php as well, needs some work but you will get the idea.

http://www.rubblewebs.co.uk/imagemagick/animation.php

If you are going to make 360 images it could take some time ! My server hung up on 23 images but when I checked the folder on the server the job was completed so I stopped the page and checked the final animation and it had worked OK.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

My one animation is pretty smooth but only using 15 degree increments.

However it looks as if you are not handling the image size changes due to the rotation, which is why you image is wandering all over the place.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo »

I was mainly trying this out for Liza and working it into a php method.

When I got home today I had recived and email from my hosts about the code slowing down the server; so if you my example be careful !!!!!

I was going to condense the code and improve it but I think I will leave it now to avoid any more slapped wrists.

With the image wandering I had assumed if I picked on point to rotate around it would work Ok. But I was wondering why it didn't.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

The -rotate resizes images to fit the rotation. That is the center point doesn't move but the image size changes.

See IM Examples 'Distorting Images' for ways of dealing with this.

As for slowing your server. Of course it will do that if you don't provide any delays in your animation. That is why a 1 degree rotation is probably a little too small.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply