Imagemagick – how to create animation on command line

Imagemagick is very powerful tool to process images on command line. If you have multiple images, you can use imagemagick convert utility on Mac or Linux to create animation (animated gif). Here are steps to create animation using imagemagick.

Create multiple png images for animation

We will use 4 images to create animation. These 4 images are created by taking window screenshot on Terminal shell while typing “Hello Animation World”.

  1. img1.png
  2. img2.png
  3. img3.png
  4. img4.png

Animation with same delay 100 and infinite loop

delay 100 is equivalent of 100/100=1 fps (frames per second).

$ convert -delay 100 -loop 0 img1.png img2.png img3.png img4.png animation1.gif

Here is the outcome animation gif image. Notice the equal delay after each frame in animation.

Animation with more delay after last image and infinite loop

We can repeat -delay param to change it for last image.

$ convert -delay 100 -loop 0 img1.png img2.png img3.png -delay 500 img4.png animation2.gif

Here is the outcome animation gif image. Notice the higher delay after last (4th) frame in animation.

Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments