MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

How Mathematica saved me about $40 in 5 minutes. Using it to create animated gif file.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69934] How Mathematica saved me about $40 in 5 minutes. Using it to create animated gif file.
  • From: "Nasser Abbasi" <nma at 12000.org>
  • Date: Wed, 27 Sep 2006 06:06:27 -0400 (EDT)
  • Reply-to: "Nasser Abbasi" <nma at 12000.org>

I had 100 png files called "1.png", "2.png", etc... (each file represent a 
frame) that were created from another software. Now I wanted to put these 
togother into one animated gif file.

I looked for some software to do this, and found many on the net. But 
nothing really free, many trial versions which do not allow one to save to 
disk, etc... I just need to do this once and did not feel I wanted to pay 
$30-$50 just to do this.

Then I remembered that Mathematica can do animation, so I wrote this short 
code below to read the image files from disk, and create the animated GIF 
file. It worked perfectly, and fast.

So I just wanted to thank Mathematica for saving me some money tonight :)
p = {};

Do[image = Import[StringJoin[ToString[i], ".png"], "PNG"];
      p = Append[p, image],
     {i, 3, 100} ];

Export[StringJoin["animated", ".gif"], p, ConversionOptions -> 
{"AnimationDisplayTime" -> 0.5, "Loop" -> True}];

Nasser


  • Prev by Date: Re: How to remove just the outermost braces of a list?
  • Next by Date: Re: why does FindMinimum have the attribute HoldAll?
  • Previous by thread: Mac, Mathematica, and AuthorTools: Another suffix gotcha
  • Next by thread: Re: How Mathematica saved me about $40 in 5 minutes. Using it to create animated gif file.