Galaxy_Image

Importing an image and manipulating it.

Author: Valeriy Onuchin
This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Monday, February 17, 2020 at 01:59 AM.

In [1]:
TCanvas *canv = new TCanvas("image", "n4254", 40, 40, 812, 700);
canv->ToggleEventStatus();
canv->SetRightMargin(0.2);
canv->SetLeftMargin(0.01);
canv->SetTopMargin(0.01);
canv->SetBottomMargin(0.01);

Read the pixel data from file "galaxy.root" the size of the image is 401 X 401 pixels

In [2]:
const char *fname = "galaxy.root";
TFile *gal = 0;
if (!gSystem->AccessPathName(fname)) {
   gal = TFile::Open(fname);
} else {
   printf("accessing %s file from http://root.cern.ch/files\n",fname);
   gal = TFile::Open(Form("http://root.cern.ch/files/%s",fname));
}
if (!gal) return;
TImage *img = (TImage*)gal->Get("n4254");
img->Draw();
accessing galaxy.root file from http://root.cern.ch/files

Zoom the image

In [3]:
img->Zoom(80, 80, 250, 250);

Draw all canvases

In [4]:
gROOT->GetListOfCanvases()->Draw()