| About these pages |

Date: Tue, 14 Jul 1998 07:08:45 -0700 (PDT) From: Mikhail Dyachkov <dyachkov@alph04.triumf.ca>About GIFMerge:
There are a few useful "gifanimation" related programs for UNIX, the
most important (and useful) one is "gifmerge", it can be downloaded from
the first URL - you can get a source code there +
executables.
I also have put the executables (for HP) and the source code at
~misha/public/gifmerge/(in bin and src subdirs).
We used "gnuplot" to generate separate gif images using the "set term gif", if your graph software does not have "gif" output you can always save images in "postscript" and convert them into "gif" using "pstogif" (it usually bandled with Ghost Script 5.0 and up) - or you can use a "pstopnm + pnmtogif" combination
I usually save separate gif files as 001.gif 002.gif etc - in this case it is easier to call "gifmerge", e.g.
gifmerge -20 ../tmp/*.gif > anim.gif20 - is a delay in 1/100 of a second. (i.e -20 = .2sec between the snapshots);
If the files are not in alphabetical (numerical) order - you will need to list all the files in the order you need them to be shown, i.e.
gifmerge -20 file1.gif file2.gif file9.gif file8.gif > bla.gif
Export["anim.gif",
Table[Plot[Sin[n x], {x, 0, 10}], {n, 1,
5}],
"GIF", ConversionOptions -> {"Loop" -> True}
]
Example of how to create the individual GIF files with Mathematica. They are merged into an animated GIF with the command described above.
In[243]:= SetDirectory[If[$OperatingSystem=="Unix","/tmp","C:\\temp"]]
Out[243]=
"C:\\temp"The following sequence of pictures can of course be animated directly in the Mathematica Front End but the Display command also saves them as a set of .gif files to make an animated Web page. The StringReplacePart is just a way of constructing the filenames according to the recipe given above. It is then easy to use gifmerge as described above.
In[244]:= Do[
Display[
StringReplacePart["000.gif",ToString[t],{3,3}],
Plot3D[Sin[3x-y + t],{x,-2,2},{y,-2,2}],
"GIF"],
{t,0,5,1}]
<< not showing the output here >>
In[245]:= FileNames["*.gif"]
Out[245]=
{"000.gif","001.gif","002.gif","003.gif","004.gif","005.gif"}
Look at the sizes of those files
In[246]:= ByteCount /. FileInformation /@ FileNames["*.gif"]
Out[246]=
{7189,6857,6876,6634,6931,7007}
If we are on Unix,we can do
In[247]:= ReadList["!gifmerge -20 *.gif > wave.gif",String]
In[248]:= FileInformation["wave.gif"]
{File->/tmp/wave.gif",FileType->File,Date->3109483980,
ByteCount->41488}
The result is shown at the top of this page.