Ubuntu – Convert animated gifs to sprite sheets

bashcommand lineimage processingimagemagick

I have a shell scripting request. I haven’t spent much time figuring it out myself yet, but I want to try and convert animated gifs into sprite sheets for use in SDL game development. I know how to break an animated gif into a series of images: convert animation.gif target.png, but not how to string them together end to end, in a single image file.

Is there a shell command that can help me create a single sprite sheet out of multiple images?

Best Answer

It seems you have ImageMagick binaries installed already, so you can use the following command:

$ montage your_gif.gif -tile x1 -geometry +0+0 -alpha On -background "rgba(0, 0, 0, 0.0)" -quality 100 sprites.png

That should create a file named sprites.png, with the gif's frames.