Save canvas as image

Is there any command to save a canvas as an image? I known that you can do manually in the canvas menu, but I would like to do it in the script. Something like:

Hi,

On recent versions of Windows, it is not possible to write in the root dir (c:), but you can save in any directory. Just try something like:

c1->SaveAs("C:/Temp/picture.jpg");or

Cheers, Bertrand.