https://github.com/root-project/root
Raw File
Tip revision: f133d416b35f644f89da1a6d5bbcd47e0f1b526d authored by Unknown Author on 12 February 2003, 20:59:04 UTC
This commit was manufactured by cvs2svn to create tag 'v3-05-02'.
Tip revision: f133d41
pad2png.C
void pad2png()
{
   // Create a canvas and save as png.

   TCanvas *c = new TCanvas;
   TH1F *h = new TH1F("gaus", "gaus", 100, -5, 5);
   h->FillRandom("gaus", 10000);
   h->Draw();

   gSystem->ProcessEvents();

   TImage *img = TImage::Create();

   //img->FromPad(c, 10, 10, 300, 200);
   img->FromPad(c);

   img->WriteImage("canvas.png");

   delete h;
   delete c;
   delete img;
}
back to top