Wednesday, May 21, 2014

One-liner command for creating animated GIF

The command in this post requires the GraphicsMagick package (see this for an explanation). GraphicsMagick commands start with gm in front of them.

  • First have the individual frames of your animation ready, and give them similar ordered names, say frame01.png , frame02.png , frame03.png , etc. The numbers determine the order in which the frames will appear in the final animation.

  • Put all the frames in a folder (say, animFrames/ ).

  • Now use the following command in Terminal, and GraphicsMagick will convert your frames into an animation anim.gif .
    gm convert -delay 5 animFrames/frame*.png anim.gif
    
    The option -delay determines the delay between displaying frames (the unit is 1/100th of a second).

    See this for an explanation of what other options are available for this command.

No comments:

Post a Comment