long writeImageToFile(string path, string format)
This method outputs the current canvas to the file given by path, in the given by format. Currently, format must be "jpg". Normally, the output is WYSWYG, i.e. the image file created contains precisely the image visible in the view window. However, this method actually outputs what is currently drawn on the canvas (the bitmap behind the view window). Thus, if the canvas is modified via setCanvasSize, the output will not be WYSWYG.