Example of exporting a map as a JPEG or PNG image.
See the export-map.js source to see how this is done.