Re: Mathematica generating gifs for avi's

*To*: mathgroup at smc.vnet.net*Subject*: [mg29985] Re: Mathematica generating gifs for avi's*From*: axc at poincare.EECS.cwru.edu*Date*: Fri, 20 Jul 2001 03:28:48 -0400 (EDT)*Organization*: Case Western Reserve University*References*: <9ig70i$kfo$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

yes i'd already written some function to do that, see: http://vorlon.cwru.edu/~axc/Thesis/Animations/animation-gifs-6.nb including function to pad filenames with zeros. is there a built-in way to do that by the way? unfortunately there's no option for ToString[] that formats even integers with leading zeros also, to be clear, creating separate files for each gif is not necessary as Mathematica seems to be able to generate multiframe gifs no problem. however, i still have to step outside Mathematica for the gif->avi conversion (i'm using gif movie gear, which is shareware) which seems ridiculous as the mac version of Mathematica can do this internally. will this be remedied in a future version? $600 for Graphica is excessive. i'm still looking for any tips or help in using Mathematica to write my dissertation. i used latex for my ms thesis but, i mean, c'mon, it's 2001, i should be able to use Mathematica entirely given that the print version of Mathematica journal (new series) is made 99% w Mathematica according to one of its editors (except for the table of contents) alan calvitti axc at eecs.crwu.edu > On Sun, 8 Jul 2001 axc at whitesnake.ces.cwru.edu wrote: > > > you're right it works. but listen to the steps i have to take to > > generate avi's for my presentation. nevermind generating names such as > > 'frame00001.gif' so that the shareware converter (in this case gif > > movie gear) loads them in the correct order - even so there are always > > several frames out of sequence and i have to permute them manually, > > for each .avi. > > You could save yourself a lot of headaches by indexing your graphics as > you generate them and then using string manipulation functions to create > file names that are expected by the third-party program. > > Suppose that we want to save out a large collection of graphics with a > Table[] operation. For each Graphics object, we create an index and then > pad the index with an appropriate number of zeros. Here, we pad the index > such that at leas four digits are always visible. > > padZeros[str_String, len_Integer] := > Module[ > {numzeros, padstring}, > numzeros = len - StringLength[str]; > If[ > numzeros > 0, > padstring = StringJoin @@ Table["0", {numzeros}]; > padstring <> str, > str > ] > ] > > graphicsList = > Block[ > {i = 0}, > Table[ > { > i++; padZeros[ToString[i], 5], > Plot[Sin[2 \[Pi] f t],{t,0,1}, DisplayFunction -> Identity] > }, > {f,0,20,4} > ] > ]; > > Scan[ > Export["frame" <> #[[1]] <> ".gif", #[[2]], "GIF"]&, > graphicsList > ] > > -- > P.J. Hinton > User Interface Programmer paulh at wolfram.com > Wolfram Research, Inc. > Disclaimer: Opinions expressed herein are those of the author alone.