Save TCanvas without plotting?

Dear Rooters,

I would like to know if there is a way to create a TCanvas without “drawing” it and then save it as an image without a window popping up. Is this possible? Or is there a work around?

Example:

TCanvas * c1 = new TCanvas("SomeCanvasName","A Canvas"); // I would like a window to NOT pop up here
  c1->Divide(7,4);
  for(int i =0;i<28;i++) {
  c1->cd(i+1);
  bar_hits[27-i]->Draw("colz"); // I would imagine that this also needs to be considered with the problem
  }
  c1->SaveAs(Form("plots/%d/LuciteBarHits.jpg",fRunNumber));  

Cheers,
Whit

simply run in batch mode root -b -q myscript.C
or in your session call

gROOT->SetBatch();
see the Users Guide

Rene

[quote=“brun”]
or in your session call

gROOT->SetBatch();
see the Users Guide

Rene[/quote]

Thanks!