MathGroup Archive 2007

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

Search the Archive

Re: ListAnimate and GIF format saving

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83529] Re: ListAnimate and GIF format saving
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Thu, 22 Nov 2007 04:48:20 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <fi0q7r$6ls$1@smc.vnet.net>

nilaakash at gmail.com wrote:

>      I am sending a small code (in Mathematica 6.0). Here data plots
> as animation and I want to save as a .gif file.
> I have saved as an .avi file but its size is huge (~37Mb). Is it
> possible to save as .gif or any other movie type file within ~2Mb
> size ?

<snip>

Although Import can understand different compression schemes for AVI 
files (), Export do not have any option to compress the frame when 
dealing with the AVI format. The online help reads, "Export generates 
_uncompressed RGB_ frames, using a color resolution of 8 bits per 
channel. [emphasize added]" So it appears that to get a smaller AVI file 
you will have to post process it with some external tool.

Since your animation consists of a fix frame on a white background where 
some points are displayed, you could achieve a very high level of 
compression by using the SWF flash format (or the FLV might be suitable 
too).

For instance, the AVI (uncompressed) is about 37MB, the SWF file is 
about 41KB (Kilo not Mega!)

Try Export["test.swf", p]

a = 0.33; b = 0.22; c = 353;
f = a (1 - x/c)^b;
data = Table[{x, f}, {x, 352.5, 300, -0.5}];

p = ListAnimate[
   Table[ListPlot[Take[data, i], Frame -> True, Axes -> False,
     Mesh -> All, ImageSize -> 500,
     PlotRange -> {{353, 300}, {0.075, 0.22}}], {i, Length[data]}],
   AnimationRepetitions -> 2]

Export["test.swf", p]

You may want to try an even higher ratio of compression by using the 
option "CompressionMethod" -> "GZ" as in

Export["test2.swf", p, "CompressionMethod" -> "GZ"]

The resulting file is just about 20KB (but be ready to wait few minutes 
to get it) and works fine on Firefox.

Finally,

Export["test.flv", p, "FLV"]

produces a file even smaller: about 12KB (but I was not able to test it 
on my computer: the flash player was too old or the file format not 
recognized).

Regards,
-- 
Jean-Marc


  • Prev by Date: Re: DataRange
  • Next by Date: Re: StringInput Question
  • Previous by thread: Re: ListAnimate and GIF format saving
  • Next by thread: Re: ListAnimate and GIF format saving