Saves an image to file.
The file extension is used to determine to image format. The BMP (.bmp) and PNG (.png) formats are supported.