Save gif animation?

Hi,

I would like to save a bunch of Graphs as an gif animation but somehow it doesn’t work anymore with the SLC5 and root 5-25-01 (tried e.g.on lxplus249).
It works without a problem under SLC4 and root 5-23-04 …

Here is the main error message:
[…]
ASImage2gif():1069:<anim.gif>
GIF-LIB undefined error 0.
[…]

and a small example …

{ // MINIMAL WORKING EXAMPLE

  char *fileOut = "anim.gif"; 
  char animfile[100];

  gStyle->SetCanvasPreferGL(true);
  TCanvas *c1 = new TCanvas("test","test",0,0,600,700);

  for (Int_t i = 0; i<20;i++) {
    
    // simple plot
    Double_t ev = (Double_t) i;
    TH3D *his = new TH3D("ASDF","ASDF",3,0,3,3,0,3,3,0,3);
    his->Fill(0.5,1.5,1.5,1);
    his->Fill(1.5,1.5,1.5,ev);
    his->DrawCopy("GLBOX");
    his->SetStats(0);
    gPad->SetPhi(35);gPad->SetTheta(15);
    gPad->Update(); 
    his->~TH3D();

    sprintf(animfile,"%s+10",fileOut);
    c1->Print(animfile);
  }

  sprintf(animfile,"%s++",fileOut); // infinite loop
  c1->Print(animfile);

}

Any ideas?
Thanks and best regards,
Stefan

The right way would be:

{ // MINIMAL WORKING EXAMPLE

   gStyle->SetCanvasPreferGL(true);   
   TCanvas *c1 = new TCanvas("test","test",0,0,600,700);

   gSystem->Unlink("anim.gif"); // delete old file    

   for (Int_t i = 0; i<20;i++) {
      // simple plot
      Double_t ev = (Double_t) i;
      TH3D *his = new TH3D("ASDF","ASDF",3,0,3,3,0,3,3,0,3);
      his->Fill(0.5,1.5,1.5,1);
      his->Fill(1.5,1.5,1.5,ev);
      his->DrawCopy("GLBOX");
      his->SetStats(0);
      gPad->SetPhi(35);gPad->SetTheta(15);
      gPad->Update();
      c1->Print("anim.gif+"); 
      his->~TH3D();
   }
}

But i still get errors. We will investigate.

No, only questions. Why do you use his->~TH3D() ??? What do you think you are doing here and why?

Ok.
Even if I change your code to something more reasonable, like:

{ // MINIMAL NON-WORKING EXAMPLE
   gSystem->Unlink("anim.gif"); // delete old file   
   gStyle->SetCanvasPreferGL(true);   

   TCanvas *c1 = new TCanvas("test", "test", 0, 0, 300, 300);
   c1->SetPhi(35);
   c1->SetTheta(15);

   TH3D *his = new TH3D("ASDF","ASDF",3,0,3,3,0,3,3,0,3);
   his->SetStats(0);
   his->Fill(0.5,1.5,1.5,1); 

   his->Draw("GLBOX");
   c1->Print("anim.gif+");

   const Int_t bin2 = his->FindBin(1.5, 1.5, 1.5);
   for (Int_t i = 0; i < 20; ++i) {
      // simple plot
      his->SetBinContent(bin2, i);
      c1->Update();
      c1->Print(Form("anim.gif+%d", i));
   }
}

I still have this error from gif library, that’s because of the recent changes in a gl-pad (it does not use pixmaps required by asimage anymore).

So even creating a simple gif file should not work ?

I think yes. I tried it, but no such error messges from GIF lib, and only empty gif/jpg were created.

Yes I saw that too… but I think that’s connected. May be you can have a look.

Well, yes, I can try, The problem is that I’m not familiar with libAfterImage at all.