Making movies

Its actually quite easy to make a movie of an Ecolab run. Each of the base widgets of the instruments has a method called print defined in the widgets namespace, which will output a postscript representation of the widget to a file. See gen-move.tcl for an example, which produced these animated GIFs.

Once a series of postscript files are created, you can convert them into GIFs using the pstoimg1 utility that comes with LATEX2HTML, using something like the following2:

cp *.ps /tmp
for i in *.ps; do pstoimg -gif  $i; done
cp /tmp/*.gif .

Finally, use gifmerge3 to produce an animated GIF.

gifmerge *.gif >movie.gif

An alternative is to produce an AVI file using the mencoder software that comes as part of the mplayer package. First you need to prepare a collection of jpeg files:

for i in *.ps; do 
  gs -sDEVICE=ppm -sOutputFile=$f.ppm -dNOPAUSE -dBATCH -g700x400 -r50  $i
  cjpeg $f.ppm >$f.jpg
You can control the final size of the bitmap using the -g option to gs, and control the scale with the -r option (“pixels per inch”). Mplayer has problems if the bitmap is too large, and if the dimensions are odd.

Finally, you can create an mpeg1 encoding using mencoder:

mencoder -mf on:type=jpeg -ovc lavc -lavcopts vcodec=mpeg1video \
              \*.jpg -o movie.avi
Consult the mencoder man page for more details on codec options.