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?

2 Answers 2


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.

  • I''l check that out.
    – j0h
    Nov 4, 2015 at 16:15

Here is a start on a solution I made: its has some bugs. I want to add a function to create whole directories into sprite sheets.

#Convert animated gif to sprite sheet
#pass in animated gif get out png sprite sheet
convert $1 $1.png
convert `ls *.png` +append $1.png.result
rm *.png
mv $1.png.result $1.png

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.