ROOT logo
//Importing an image and manipulating it
//Author: Valeriy Onuchin
   
void galaxy_image()
{
   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
   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();

   // open the color editor
   img->StartPaletteEditor();

   // zoom the image
   img->Zoom(80, 80, 250, 250);
}
 galaxy_image.C:1
 galaxy_image.C:2
 galaxy_image.C:3
 galaxy_image.C:4
 galaxy_image.C:5
 galaxy_image.C:6
 galaxy_image.C:7
 galaxy_image.C:8
 galaxy_image.C:9
 galaxy_image.C:10
 galaxy_image.C:11
 galaxy_image.C:12
 galaxy_image.C:13
 galaxy_image.C:14
 galaxy_image.C:15
 galaxy_image.C:16
 galaxy_image.C:17
 galaxy_image.C:18
 galaxy_image.C:19
 galaxy_image.C:20
 galaxy_image.C:21
 galaxy_image.C:22
 galaxy_image.C:23
 galaxy_image.C:24
 galaxy_image.C:25
 galaxy_image.C:26
 galaxy_image.C:27
 galaxy_image.C:28
 galaxy_image.C:29
 galaxy_image.C:30
 galaxy_image.C:31
 galaxy_image.C:32
 galaxy_image.C:33
thumb
thumb