Skip to main content
Working from scratch, following simplicity

ImageMagick: two fast methods to make a GIF from images

Free software helps you a lot in many fields, even in generating a GIF animation from images. I wan to show you the use of "convert", a command line tools of ImageMagick, can easily solve this task with two awesome methods: one that simply creates a transition between a series of images and another that makes a morphing among them. Let's see how.

ImageMagick is free software to create, edit, compose, or convert bitmap images (in a large variety of formats). It is delivered as a ready-to-run binary distribution or as source code that you may use, copy, modify, and distribute in both open and proprietary applications. It is distributed under a derived Apache 2.0 license. It runs on Linux, Windows, Mac Os X, iOS, Android OS, and other.

It also utilizes multiple computational threads to increase performance and can read, process, or write mega-, giga-, or tera-pixel image sizes. But in this article I will highlight its feature to create an animated GIF starting from a list of images.

ImageMagick: two fast methods to make a GIF from images

A simple animation

In order to create an animation from two images, called dog1.jpg and dog2.jpg, you can launch the following line-command:

convert -resize 200x200 -delay 100 -loop 0  dog1.jpg dog2.jpg animation1.gif

To obtaining this GIF:

First example: a simple animation

Where the animation is called animation1.gif, the delay is set to 100 milliseconds and the loop is limitless.

A morphing animation

To create an animation with a morphing effect, you can launch the following line command:

convert -resize 200x200 dog2.jpg dog1.jpg -delay 20 -morph 10 animation2.gif

To obtaining this GIF:

Second example: a morphing animation

Where the animation is called animation2.gif, the delay is set to 20 milliseconds and the morph is set to 10 frames between images.

Bonus

I showed two simple examples, after all ImageMagick supports filename globbing, for example, suppose you want to convert dog1.jpg, dog2.jpg, dog3.jpg, dog4.jpg, and so on in your current directory to a GIF animation. You can conveniently refer to all of the JPEG files with this command:

convert -resize 200x200 *.jpg -delay 20 -morph 10 animation2.gif

Or if you have also different images in JPEG format (i.e. cat1.jpg, cat2.jpg, etc.), it's better this one:

convert -resize 200x200 dog*.jpg -delay 20 -morph 10 animation2.gif

Last but not least, you can set the border color to your GIF, for example yellow in this manner:

convert -resize -border 10x5 -bordercolor "#eeff00" dog*.jpg -delay 10 -morph 10 animation3.gif
Third example: add a yellow border

TAGS MULTI

Add new comment

The content of this field is kept private and will not be shown publicly.

Plain text

  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

Add new comment

The content of this field is kept private and will not be shown publicly.

Plain text

  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Sponsored Links
Pubblicità

Nicola Rainiero

A civil geotechnical engineer with the ambition to facilitate own work with free software for a knowledge and collective sharing. Also, I deal with green energy and in particular shallow geothermal energy. I have always been involved in web design and 3D modelling.