Page 1 of 1

Making a gif by rotating an image

Posted: 2017-01-16T08:20:35-07:00
by dargaud
Hello all,
it's been a while since I last did any 'advanced' IM tricks, so I'm a little rusty. I'd like to take an image and make a gif (or any video format with settable speed and looping) with that image, then that same image rotated by 360*1/n, that same image rotated by 360*2/n, ... that same image rotated by 360*(n-1)/n, and then loop the gif. Where n is the number of divisions of the circle.

Any idea ? Thanks

Re: Making a gif by rotating an image

Posted: 2017-01-16T08:42:50-07:00
by snibgo
For example, 36 views at 10 degree intervals:

Code: Select all

convert rose: -duplicate 35 -distort SRT 1,%[fx:t*10] x.gif

Re: Making a gif by rotating an image

Posted: 2017-01-16T08:47:30-07:00
by GeeMack
dargaud wrote: 2017-01-16T08:20:35-07:00I'd like to take an image and make a gif (or any video format with settable speed and looping) with that image, then that same image rotated by 360*1/n, that same image rotated by 360*2/n, ... that same image rotated by 360*(n-1)/n, and then loop the gif. Where n is the number of divisions of the circle.
Please remember to always provide your IM version and which OS or platform you're working on.

In concept, with any recent version of IM, this should make a 24 frame animated GIF, each frame rotated by 360/24 more than the previous frame.

Code: Select all

convert input.png -duplicate 23 -distort SRT %[fx:t*360/n] -set delay 10 -loop 0 output.gif

Re: Making a gif by rotating an image

Posted: 2017-01-16T22:32:32-07:00
by anthony
See IM Examples, GIF animations, for an explanation of this technique...
http://www.imagemagick.org/Usage/anim_mods/#distort

For older technique see
Simple Image Warping, Animations
http://www.imagemagick.org/Usage/warping/#animations

Re: Making a gif by rotating an image

Posted: 2017-01-17T07:46:51-07:00
by dargaud
Thanks, that's what I was looking for. Although I couldn't get -delay to work in either .gif or .mng output until I saw GeeMack's syntax being "-set delay". In many places of the documentation it's given as -delay (even the man page) and it doesn't work. I'm using version 6.8.9-9 Q16 x86_64 2016-11-29

Re: Making a gif by rotating an image

Posted: 2017-01-17T09:33:09-07:00
by fmw42
Use -delay before reading the input images or use -set delay after reading the input images.

Re: Making a gif by rotating an image

Posted: 2017-01-17T17:41:18-07:00
by anthony
See... GIF Animations Basics....
http://www.imagemagick.org/Usage/anim_basics/#gif_anim

Also see Basics, Setting/Changing Image Attributes/Properities
http://www.imagemagick.org/Usage/basics/#attributes