How to convert set of image to GIF using ImageMagick.

  • Posted on: 6 May 2020
  • By: dexter

ImageMagick is free software that can be used to create/modify images of various different format (more than 200).  ImageMagick consists of two command line utilities to do a lot interesting work.

  • convert 
    • This usually does not change the original image
  • mogrify
    • This usually work/updates the original image.

How do we use this to convert a small animation using a set of image.

Say I have the following images 1.png to 8.png where in every there is a slight change is there in every image. (shown below) 

Bouncing ball frames

So how do we get these image to an animated gif or png

convert file1 file2 file3 ..... fineN  Output.gif

So the actual command is

convert 1.png 2.png 3.png ... 8.png ball.gif   

 // or //

convert *.png bb.gif   

an optional delay can be used to specify number of seconds that should be there between two frames.  i.e. -delay 60 will give a 1 sec difference and -delay 300 will give a difference of 5 seconds

convert -delay 300 *.png bb.gif     // images change with a delay of 5 seconds.
(in this case make sure you do not have any other file in the current directory also the files should be in correct sequence)

From this we will get an animation like the following:

Bouncing ball animation


So simple. Enjoy 


Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Enter the characters shown in the image.