Printing root files in png or jpeg format without canvas

Hello, I have installed root on a dedicated server and I need to convert a histogram in an image without using canvas I can only access the server remotely.
Thanks

Start root with the option -b:

$ root -b

Or set the batch mode in your macro:

gROOT->SetBatch();