Tcanvas rendered in black in batch mode

Dear rooters,

I am trying to run ROOT 18/00 Mac 10.4.11 in quite batch mode, knowing that my code generate figures. In order to read then easily I hence Print or SaveAs the TCanvas generated.

But: if I start the macro from the command line and save the canvas using Save or SaveAs in the menu the GIF is as expected (see file good.gif). Now if in this code I save the canvas with the method SaveAs or Print or even the method described in … =gif+black
this gives me the black GIF (or JPG I tested) ‘bad.gif’. This does not append with (e)ps.

Is there another solution or some option I must choose ?

Note:The canvas is divided, the picture on the left if a TH1F with some fitted function and the picture on the right is TH2F with a TGraph on the top of it. I tried to paint the left first or the right first, put the right on left and vice versa … If I don’t paint the TGraph then I can see the TH2F but it is located on left, the TH1F is not visible and the right pad is empty.


You said you root version is ROOT 18/00 … Is it root 5.18 ? or ?

Yes this is 5.18. Sorry about that. Sorry also to have post it – by mistake – in discussion. This should be in support.


Can you tried with 5.19 ? several bug fixes have been done in that area recently.

Yes. I will try. The 5.19 download page only leads me to 5.18 which I suppose normal since 5.19 is in development.
I will try to download it from cvn, that I first need to install on Mac except if there is a easier solution ?


may be you can get it from here:

No. This is where I started and the 5.19 page leads me to the 5.18 codes.


Ah … so yes, may be the way to do is via SVN.

So I installed the last version that svn gave me namely v5-18-00a (apparently not 5.19) and the GIF problem I described is still here.


The only Mac i have access to is:

MACPHSFT01:~/root/test couet$ uname -a
Darwin MACPHSFT01 8.11.0 Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC Power Macintosh powerpc

On this machine I did:

cd $ROOTSYS/test
./stressGraphics -k

The stressGraphics program generates many gif png et jpg files in batch mode. They are coorect with the ROOT version I have:

ROOT 5.19/01 (trunk@22405, Feb 29 2008, 15:52:50 on macosx)

May be that’s not the kind of Mac you are talking about ?

To get root from the svn repository you should do as explained here:

Dear Olivier,

I did follow the link for the svn repository and it is how I compiled my 18.00a version (I not only retrieved the 18.00a tag but also did svn up)

Now, concerning the test you suggested, beside the fact the compilation of all the test fail (missing some struct TGeoTranslation in TGeoPatternFinder.h, which might be due to the fact that I did not explicitly compiled some GEANT4 stuff), ./stressGraphics compiled but ./stressGraphics -k fail (I do have a ROOTSYS pointing to the direction where hsimple.root can be found)

I fill investigate this more.

Finally, this is the result of uname -a on my Mac:


So your Mac version seems a bit ahead … but it seems we are running on the same kind of machine. I do not have any problem on my.

To get 5.19 do:

svn co root

Dear Olivier,

So. I download 5.19/01 from cvn. I compiled root and succeded in compiling stressGraphics. This last program run fine.
1/ my code with root still give the same (bad) result
2/ I don’t know what stressGraphics is supposed to give me (I compared w/ PNG and PDF). So I attached to this post the two figures that look like suspicious to me (sg03 and sg36).


yes it is ok… it is not black. Ca you send me a small macro reproducing your problem on Mac ?

Attached to this post a small ROOT file (tmp.root) with a small macro (test_macro.C), to be run w/

test_macro.C (223 Bytes)
tmp.root (235 KB)

Ok I see the black picture. On the right side only. But that is not Mac specific. I see it also on my linux box. I do not know yet what it is … I’ll let you know.

Ok. For the left side: if you switch the two histogram (1D and 2D) then the black will be everywhere (I think). If you remove the TGraph then the black disappears but one pad is not drawn.

Thank you for the help.


As a temporary workaround it seems that if you do:


Then the image is correct. I continue to investigate.