Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
pad2png.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_image
3 /// \notebook
4 /// Create a canvas and save as png.
5 ///
6 /// \macro_image
7 /// \macro_code
8 ///
9 /// \author Valeriy Onuchin
10 
11 void pad2png()
12 {
13  TCanvas *c = new TCanvas;
14  TH1F *h = new TH1F("gaus", "gaus", 100, -5, 5);
15  h->FillRandom("gaus", 10000);
16  h->Draw();
17 
18  gSystem->ProcessEvents();
19 
20  TImage *img = TImage::Create();
21 
22  img->FromPad(c);
23 
24  img->WriteImage("canvas.png");
25 }