Created
February 1, 2012 11:41
-
-
Save hitode909/1716686 to your computer and use it in GitHub Desktop.
アニメーションGIF逆再生するやつ
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
# -*- 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