How to convert set of image to GIF using ImageMagick.

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

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
CAPTCHA
Enter the characters shown in the image.
Are you a robot?
Address

OpenSourceCook.in
"Natraj"  Bungalow,
Colony No.7,  Sr.No. 38.
(Lane Behind Sai Baba Mandir)
Kale Borate Nagar, Hadapsar,
Pune - 411028.
Get Directions