ryanfb / gifrandom.rb secret
Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

GIF frame randomizer

View gifrandom.rb
1 2 3 4 5 6
#!/usr/bin/env ruby
 
frames=`gifsicle -I #{ARGV[0]}|head -1`.match(/ (\d+) images/)[1].to_i - 1
shuffled=(0..frames).to_a.shuffle.map{|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
Something went wrong with that request. Please try again.