Print histogram in "batch-like" mode

Dear Rooters,

I have the following problem:

I would like to print a number of histograms to files (say gif). Now, the easiest way to achieve this is of course to simply do:

TCanvas c1;
TH1F* h1 = // get from file
h1->Draw();
c1->Print("FileName.gif");

Here is the “problem” I would like to overcome: I am printing (potentially) many histograms from within a loop. Each time I create the canvas, it will be shown at least for a short moment, before being destroyed at the end of the loop. Since I am not interested in the graphical output on screen, I was wondering if one can prevent the canvas from actually being drawn, or if there is another possibility to print a histogram in a “batch-like” way? I could of course create one canvas before the loop and reuse it during the loop, but I am looking for a solution to suppress the drawing on screen.

To take one more point beforehand: No, I cannot simply work in batch mode in this application

any hints appreciated,

cheers,

Erik

So I guess you are aware how to start root in batch mode using option “-b”. But you said that’s not what you want. You can also turn on the batch mode temporally during a root session with gROOT->SetBatch(kTRUE);
Then you can come back to the normal mode using “kFALSE”.

[quote]So I guess you are aware how to start root in batch mode using option “-b”.
[/quote]
Indeed.

[quote]
You can also turn on the batch mode temporally during a root session with gROOT->SetBatch(kTRUE);
Then you can come back to the normal mode using “kFALSE”.[/quote]

This, on the other hand, it did not know, and it does exactly what I want.

Thanks a lot.

Cheers,

Erik