GIF Animation

Hi,

I’m using ROOT version 5.12/00 (10-July-2006).

I’m trying to find a faster way to make some animations. I use ROOT to read in an output file from a simulation and create 16 canvas’s. I then take screen shots of each and save them as gifs and use MSgif to create the animation:

I now can save the canvas’s automatically as gifs using the option:

ts2.Print("02.gif");

Then I use those with MSgif to create the animation. For a few animations this is easy, but I now need to do about 300. (And probably more in the future).

From the page: http://root.cern.ch/root/html/TPad.html it states:

[code] It’s posiible to Print pad into an animated GIF file by specifying file name as
“myfile.gif+” of “myfile.gif+NN” , where NN is delay of displaying subimages
during animation in 10ms units. If NN is ommitted the delay between subimages is zero.

for (int i=0; i<10; ++i) {
  // fill canvas for context i
  // ...

  c1.Print("file.gif+5");  // print canvas to GIF file with 50ms delays
}// end loop

[/code]

I tried this in my macro (attached), but it creates an unreadable “01.gif+5” file. The file is about 9 times larger (47kB) than an individual gif image (7 kB). I tried changing the extension from gif+5 to gif, but the file was still not readable.

Any ideas? Thanks!
DensityPlot.C (11.5 KB)

In version 5.13/04 we introduced the possibility
-to create animated gif files
-to view them
without using an external tool, and it is trivial to use.
For more info see the 5.13/04 release notes at
root.cern.ch/root/Version513.news.html
and look section “Animated GIF files”

Rene

Hi,

Thanks! I updated and now it works!

Is there an option to have continuous cycling of the animation (i.e. endless loop or be able to set some loop number to run through)?
I didn’t see anything about that in the release notes.

Hi,
we will add an option which allow to produce continuous animation
and possibility to display animated GIFs in canvas and GUI frames.
We are working on it. Hopefully be done next week.

Regards. Valeriy

Hi,
I sent a patch (must be in CVS asap)
which allows to produce GIFs with continuous animation.
To make it one must add “++” to the file name when the last subimage is written.

For example,

    for (int i=0; i<10; ++i) {
      // fill canvas for context i
      // ...
      c1.Print("file.gif+5");  // print canvas to GIF file with 50ms delays
    }// end loop
 c1.Print("file.gif++"); // produces infinite loop animated GIF  

It’s also possible to specify the number of animation cycles
as c1.Print(“file.gif++NN”), where NN - a number of cycles

Regards. Valeriy

Thanks,

I just installed 5.14/00 and the continual cycling gif animations work great!! :smiley:

Cheers,
August

That file.gif++ doesnt work!
Gif is not in a loop…
5.17/08 version of ROOT

Sorry, its a problem with Opera browser.
In IE that Gif is infinite…

BUT there are many other animated gifs on the web…
And all of them have a loops in Opera!
So it is still the problem with ROOT gifs - they are not infinite in Opera.

Try with: for (int i=0; i<10; ++i) { // fill canvas for context i // ... c1.Print("file.gif+5"); // print canvas to GIF file with 50ms delays }// end loop c1.Print("file.gif++5"); // produces infinite loop animated GIF I.e. have the number also listed in the last statement.

Cheers,
Philippe

No it doesnt help.
It is still repeated only once in Opera.