Logo ROOT   6.21/01
Reference Guide
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 
19 
20  TImage *img = TImage::Create();
21 
22  img->FromPad(c);
23 
24  img->WriteImage("canvas.png");
25 }
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition: TSystem.cxx:410
virtual void WriteImage(const char *, EImageFileTypes=TImage::kUnknown)
Definition: TImage.h:115
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:571
An abstract interface to image processing library.
Definition: TImage.h:29
R__EXTERN TSystem * gSystem
Definition: TSystem.h:557
#define h(i)
Definition: RSha256.hxx:106
The Canvas class.
Definition: TCanvas.h:31
virtual void FromPad(TVirtualPad *, Int_t=0, Int_t=0, UInt_t=0, UInt_t=0)
Definition: TImage.h:122
#define c(i)
Definition: RSha256.hxx:101
static TImage * Create()
Create an image.
Definition: TImage.cxx:36