Skip to content

Instantly share code, notes, and snippets.

@dguzzo
Last active October 29, 2016 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dguzzo/99bbca3df827df475f768383a1b04102 to your computer and use it in GitHub Desktop.
Save dguzzo/99bbca3df827df475f768383a1b04102 to your computer and use it in GitHub Desktop.
make an animated gif from some jpegs with RMagick
#!/usr/bin/env ruby
require "RMagick"
RESIZE = 0.25
DELAY = 10
FILENAME = "quartz-composer-process.gif"
puts "loading image files"
files = Dir.glob('*.jpg')
if files.length < 1
puts "no images files found--exiting."
exit
end
anim = Magick::ImageList.new(*files)
puts "animating #{anim.length} files"
puts "setting delay to #{DELAY} and resize scale to #{RESIZE}"
anim.each {|i| i.delay = DELAY; i.resize!(RESIZE)};
puts "outputting as #{FILENAME}"
anim.write(FILENAME)
@dguzzo
Copy link
Author

dguzzo commented Oct 9, 2016

not flexible at all at the moment! for instance, the Dir.glob value is hardcoded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment