Skip to content

Instantly share code, notes, and snippets.

@hitode909
Created February 1, 2012 11:41
Show Gist options
  • Save hitode909/1716686 to your computer and use it in GitHub Desktop.
Save hitode909/1716686 to your computer and use it in GitHub Desktop.
アニメーションGIF逆再生するやつ
# -*- coding: utf-8 -*-
require 'rubygems'
require 'RMagick'
filename = ARGV.first
unless filename
warn "usage: #{$0} <ANIMATION GIF FILE>"
exit 1
end
source = Magick::ImageList.new(filename)
dest = Magick::ImageList.new
source.coalesce.reverse.each{ |frame|
dest.push frame
}
dest.delay = source.delay
dest.iterations = 0
dest.optimize_layers(Magick::OptimizeTransLayer).deconstruct.write("out.gif")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment