Logo ROOT  
Reference Guide
pad2png.C File Reference

Detailed Description

View in nbviewer Open in SWAN Create a canvas and save as png.

void pad2png()
{
TCanvas *c = new TCanvas;
TH1F *h = new TH1F("gaus", "gaus", 100, -5, 5);
h->FillRandom("gaus", 10000);
h->Draw();
img->FromPad(c);
img->WriteImage("canvas.png");
}
#define c(i)
Definition: RSha256.hxx:101
#define h(i)
Definition: RSha256.hxx:106
R__EXTERN TSystem * gSystem
Definition: TSystem.h:560
The Canvas class.
Definition: TCanvas.h:31
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
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:36
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:426
Author
Valeriy Onuchin

Definition in file pad2png.C.