Convert from .C macro to png

I have my images saved as .C macros so that I can go back and edit them if need be. I want to write a simple c++ function that will open these macros and save them as png. I cannot get this to work.

My images are saved as .C files where it is a simple histogram that is drawn to a canvas that is named c1. Even with a simple macro such as:

{
  gSystem->Load("myMacro.C");
  c1->SaveAs("myMacro.png");
}

If I enter each of these lines by hand in root it works, but as soon as it is in a macro it does not recognize c1 as existing.

My ultimate goal is a compiled program that does not open ROOT visually and creates a .png for each .C, but I cannot get that to work until I can get ROOT to recognize the canvas from the .C file.


Please read tips for efficient and successful posting and posting code

_ROOT Version:6.04.02
Platform: Not Provided
_Compiler:g++ 4.9


Loading the macro is not enough. You should execute it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.