ROOT
master
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
11
void
pad2png()
12
{
13
TCanvas
*
c
=
new
TCanvas
(
"c1"
,
"Creating image from histogram drawing"
, 800, 600);
14
TH1F
*
h
=
new
TH1F
(
"gaus"
,
"gaus"
, 100, -5, 5);
15
h
->FillRandom(
"gaus"
, 10000);
16
c
->Add(
h
);
17
c
->Update();
18
19
std::unique_ptr<TImage> img(
TImage::Create
());
20
img->FromPad(
c
);
21
img->WriteImage(
"canvas.png"
);
22
}
c
#define c(i)
Definition
RSha256.hxx:101
h
#define h(i)
Definition
RSha256.hxx:106
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TH1F
1-D histogram with a float per channel (see TH1 documentation)
Definition
TH1.h:878
TImage::Create
static TImage * Create()
Create an image.
Definition
TImage.cxx:34
tutorials
visualisation
image
pad2png.C
ROOTmaster - Reference Guide Generated on Tue Oct 20 2026 15:13:16 (GVA Time) using Doxygen 1.10.0