2011年7月28日 星期四

Convert animated GIF into Sprite

  Sprite is a huge image which contains multiple sub-images, each of them is a frame of an animation. By combining different small pieces images into a large file, we can easily implement animation by offsetting a "window" in sprite. This technology is frequently used in performance-critical scenario, such like 2D video game animation. There are multiple tools to create a sprite, like Adobe PhotoShop or Flash. But if you want to convert an existent animated GIF into a sprite, you dont need to have such luxury tool. There is a more easy way to achieve this (but still not so trivial) by using ImageMagick. It's so simple, just a one line command:


montage input.gif -tile x1 -geometry '1x1+0+0<' -alpha On -background "rgba(0, 0, 0, 0.0)" -quality 100 output.gif
Thats it! Remember that use your input file name to replace input.gif. Thanks to Nick. This awesome command is originally from TIGForums

沒有留言:

張貼留言