Skip to content

Instantly share code, notes, and snippets.

@israelb
Forked from grough/00-100-colours.gif
Created November 30, 2015 17:24
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save israelb/ee49f8710843ee50f41c to your computer and use it in GitHub Desktop.
Save israelb/ee49f8710843ee50f41c to your computer and use it in GitHub Desktop.
Generate animated gif with ruby + rmagick
require "rubygems"
require "rmagick"
include Magick
frames = 100
gif = ImageList.new
frames.times do |i|
colour = "#"; 3.times {
colour << "%02X" % (rand * 256)
}
gif << Image.new(130,50).color_fill_to_border(1, 1, colour)
end
gif.write("00-#{frames}-colours.gif")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment