Last active
October 29, 2016 19:04
-
-
Save dguzzo/99bbca3df827df475f768383a1b04102 to your computer and use it in GitHub Desktop.
make an animated gif from some jpegs with RMagick
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
not flexible at all at the moment! for instance, the
Dir.glob
value is hardcoded.