Saving canvas as gif file

Hi,
when I write in my macro:
void mymacro(){

TCanvas *c1 = new TCanvas(“c1”,“MyCanvas”,0,0,500,500);
histogram->Draw(); // 1D histogram filled with some data
c1->SaveAs(“histogram.gif”);

}
and run this with
root -q -b mymacro.C
the resulting gif file has size more than 100 kB

when I draw the histogram interactively and (using the mouse) save it as gif, I’m left with a gif file of just 5 kB!!!

Looking at resulting gif files, I can’t see any difference in quality.

How to force ROOT to make a reasonably small gif file using TCanvas::SaveAs?

I’m using version 5 of root…
the big file is www.star.bnl.gov/~kapitan/15.gif,
the small one www.star.bnl.gov/~kapitan/abc.gif

Thanks for help

Hi,
we have different GIF image generation algorithms for
interactive and batch mode.
Hopefully we will remove this difference in the nearest future.
I would recommend to use PNG instead of GIF image format.

Regards. Valeriy

Hi,
saving to PNG file works fine:-)
In fact I don’t need gif files any more…
Cheers
Jan

and PNG file size is about 5-10 kB, which is good