How to create an animated image (GIF) using Imagemagick and python ?

Published: May 02, 2021

Tags: Python; Imagemagick; GIF;

DMCA.com Protection Status

Example of how to create an animated image (GIF) using python and Imagemagick

Create a GIF with imagemagick

To create a gif (animated image) a solution is to use imagemagick.

For example, let's take the following list of images:

How to create an animated image (gif) using python and Imagemagick ? How to create an animated image (gif) using python and Imagemagick ? How to create an animated image (gif) using python and Imagemagick ?
How to create an animated image (gif) using python and Imagemagick ? How to create an animated image (gif) using python and Imagemagick ? How to create an animated image (gif) using python and Imagemagick ?
How to create an animated image (gif) using python and Imagemagick ? How to create an animated image (gif) using python and Imagemagick ? How to create an animated image (gif) using python and Imagemagick ?
How to create an animated image (gif) using python and Imagemagick ?

to create a gif from those images then enter the following command in your terminal:

 convert gb-image-rotation-scipy-matplotlib-angle-* eiffel-tower.gif

Note: to slow down the scrolling you must use the -delay argument, as in this example:

 convert -delay 100 *_adjusted.png animation.gif

Create a GIF using imagemagick and python

Now to use the command with python, a solution is to use the os module:

import os

cmd = "convert gb-image-rotation-scipy-matplotlib-angle-* eiffel-tower.gif"

os.system(cmd)

returns

How to create an animated image (gif) using python and Imagemagick ?
How to create an animated image (gif) using python and Imagemagick ?

Références

Image

of