Skip to end of metadata
Go to start of metadata

It is planned to allow Metview to directly create animated files. In the meantime, it is easily possible to convert its PostScript output using the ImageMagick convert command. Below are some examples of doing this, along with an example showing how to incorporate this into a Metview macro.

Please note, if you only try to achieve an animation with a relative small number of images within PowerPoint you might want to consider the options provided by PowerPoint. The Insert > Photo Album might be one of them.

Converting a multi-page PostScript to an animated GIF

convert -delay 200 -rotate "90<"  output.gif

Tip: Alter the speed of animation

To change the animation speed use

convert  -delay 100 input.gif output.gif

Tip: High-quality larger images

Simply setting the -geometry flag to obtain a larger output file does not ensure high quality; instead use something like

convert -density 150 input.gif  output.gif

Tip: Continuous looping

Some viewers, especially some versions of MS PowerPoint, only play a single animation cycle. To make it continuous you can use the option -loop with convert:

convert  -loop 999 input.gif output.gif

NOTE: In Microsoft PowerPoint in most cases it should work to import the GIF as an 'Image'. If the GIF is imported as a 'Video file', PowerPoint requires extra settings for continuous looping of GIFs. Go to the "video tools" menu, which contains "format" and "playback". Under the playback menu, there is a button "Loop until stopped". Click on it, to allow continuous loops!

Tip: Transparent background

You can also use convert to replace any white in the image with a transparent background:

convert  -fuzz 10% -transparent white input.gif output.gif



Example Metview Macro

The following macro retrieves several time steps of data from MARS, plots them to a PostScript file and uses the convert command to generate an animated gif. The result is shown on this page.

# Metview Macro

#  **************************** LICENSE START ***********************************
#  Copyright 2014 ECMWF. This software is distributed under the terms
#  of the Apache License version 2.0. In applying this license, ECMWF does not
#  waive the privileges and immunities granted to it by virtue of its status as
#  an Intergovernmental Organization or submit itself to any jurisdiction.
#  ***************************** LICENSE END ************************************

# retrieve some data from MARS

t2m_fc = retrieve(
        type    : "fc",
        levtype : "sfc",
        param   : "2t",
        time    : 00,
        step    : [00,"to",72,"by",6],
        grid    : [1.5,1.5]

# define our plotting attributes

t_shade = mcont(
        legend                    : "on",
        contour_automatic_setting : "ecchart"

view = geoview(
        map_area_definition : "corners",
        area                : [30.62,-25.4,70.12,40.36]

# plot the data

outdir      = getenv('SCRATCH')
outbasename = "t2m_fc"
ps = ps_output(output_name : outdir & "/" & outbasename)
plot(view, t2m_fc, t_shade)

# force Macro to wait for the plot to be generated, then convert
# to animated gif

setoutput(ps) # wait for the plot file to be generated
shell('convert -delay 100 -rotate "90<"  ' & outdir & '/' & outbasename & '.ps ' & outdir & '/' & outbasename & '.gif')
  • No labels


  1. Mac fans can use quicktime or 'Graphic Converter' to do batch conversion of large numbers of image files to movie format.

  2. To create an HD movie I use:

    ffmpeg -framerate 12 -i images_%04d.png -s:v 1920x1080 -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p movie.mp4
    1. That's great - thanks for sharing!