ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
pad2png.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_image
3 /// Create a canvas and save as png.
4 ///
5 /// \macro_image
6 /// \macro_code
7 ///
8 /// \author Valeriy Onuchin
9 
10 void pad2png()
11 {
12  TCanvas *c = new TCanvas;
13  TH1F *h = new TH1F("gaus", "gaus", 100, -5, 5);
14  h->FillRandom("gaus", 10000);
15  h->Draw();
16 
18 
19  TImage *img = TImage::Create();
20 
21  img->FromPad(c);
22 
23  img->WriteImage("canvas.png");
24 }
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition: TSystem.cxx:420
virtual void WriteImage(const char *, EImageFileTypes=TImage::kUnknown)
Definition: TImage.h:131
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:570
An abstract interface to image processing library.
Definition: TImage.h:45
virtual void FillRandom(const char *fname, Int_t ntimes=5000)
Fill histogram following distribution in function fname.
Definition: TH1.cxx:3330
R__EXTERN TSystem * gSystem
Definition: TSystem.h:545
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2878
static TImage * Create()
The Canvas class.
Definition: TCanvas.h:48
virtual void FromPad(TVirtualPad *, Int_t=0, Int_t=0, UInt_t=0, UInt_t=0)
Definition: TImage.h:138