Create a gist now

Instantly share code, notes, and snippets.

@ryanfb /gifrandom.rb Secret
Last active Dec 17, 2015

What would you like to do?
GIF frame randomizer
#!/usr/bin/env ruby
frames=`gifsicle -I #{ARGV[0]}|head -1`.match(/ (\d+) images/)[1].to_i - 1
shuffled=(0..frames){|i| "\"##{i}\""}.join(' ')
random=File.basename(ARGV[0],'.gif') + '-random.gif'
`gifsicle --colors=255 #{ARGV[0]} | gifsicle --unoptimize | gifsicle -O3 #{shuffled} > #{random}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment