Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
11void 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}
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
R__EXTERN TSystem * gSystem
Definition TSystem.h:561
The Canvas class.
Definition TCanvas.h:23
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:622
An abstract interface to image processing library.
Definition TImage.h:29
virtual void FromPad(TVirtualPad *, Int_t=0, Int_t=0, UInt_t=0, UInt_t=0)
Definition TImage.h:122
static TImage * Create()
Create an image.
Definition TImage.cxx:35
virtual void WriteImage(const char *, EImageFileTypes=TImage::kUnknown)
Definition TImage.h:115
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition TSystem.cxx:416