Index of all articles

Animated Gifs with Ruby and RMagick

Here an nice example (a sort of animated mandala, if you look long enough on it some optical illusions will appear):

some more examples

I produced 255 png pictures on basis of a mthematical function an animated them with this short ruby program (Put this little script into the directory where your pics are, change png in animation =[“.png”]) to whatever pics you want to animate, may be jpg :


require 'RMagick'
include Magick

animation =*Dir["*.png"])
animation.delay = 10

You have to install RMagick Imagemagick, and of course Ruby to do this.

And by the way, having Imagemagick installed there is also the convert comand line tool. So you can do your animations by doing this:

~:convert *.png animated.gif

Hint needed!

If you know a program that can do animations with more than 256 frames and does not render the frames (I want every pixle for example MS moviemaker can’t do that) please tell it to:

ok this (mencoder/mplayer) is quite good: