SimpleBlog
Index of all articlesAnimated 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):
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 = ImageList.new(Dir[“.png”]) to whatever pics you want to animate, may be jpg :
#!/bin/ruby
require 'RMagick'
include Magick
animation = ImageList.new(*Dir["*.png"])
animation.delay = 10
animation.write("animated.gif")
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: kizuu@muzuu.org.
ok this (mencoder/mplayer) is quite good: