Page 1 of 1

Creating an animated gif/mng from a sprite sheet

Posted: 2012-10-13T02:58:45-07:00
by xanatos
I have a png sprite sheet (8 small frames put in this way: 12345678). I want to convert it to an animated gif and to an animated mng. The sprite sheet is 128x16. I want the frames to be 16x16.

I want to do it by command line, if possible in a single command.

I have tried something like:

convert -crop 16x16 +repage base.png -delay 20 -loop 0 result.gif

but the frames aren't animated "in place" (the animation is showed as: 1......., 12......, 123....., 1234...., 12345..., 123456.., 1234567., 12345678, 1......., where 1...8 are the frames and . is "blank")

Thanks a lot!

Re: Creating an animated gif/mng from a sprite sheet

Posted: 2012-10-13T05:27:04-07:00
by xanatos
Found.

convert -dispose 3 -delay 20 -loop 0 base.png -crop 16x16 +repage result.gif

the order of the operators was wrong.

Re: Creating an animated gif/mng from a sprite sheet

Posted: 2012-10-13T07:37:44-07:00
by fmw42
-dispose and -delay should come before the input image and -loop should be last before the output

Re: Creating an animated gif/mng from a sprite sheet

Posted: 2012-10-13T07:56:27-07:00
by xanatos
fmw42 wrote:-dispose and -delay should come before the input image and -loop should be last before the output
Just checked... -loop can go where I put it or between the input file name and the output file name (I have used a -loop 2 to test this)

Re: Creating an animated gif/mng from a sprite sheet

Posted: 2012-10-13T10:03:40-07:00
by fmw42
I am just going by Anthony's recommendations at http://www.imagemagick.org/Usage/anim_basics/#gif_anim

"As such I recommend that you always set "-loop" when creating a GIF animation, after all the images has been read in."