You can use two ways: using html2canvas
to generate an image or Google static maps API.
Google static maps API
function mapeado(geocoder, map, infowindow) {
var staticMapUrl = "https://maps.googleapis.com/maps/api/staticmap";
//Set the Google Map Center.
staticMapUrl += "?center=" + document.getElementById('lat').value + "," + document.getElementById('lng').value;
//Set the Google Map Size.
staticMapUrl += "&size=640x480&scale=2";
//Set the Google Map Type.
staticMapUrl += "&maptype=hybrid";
//Set the Google Map Zoom.
staticMapUrl += "&zoom=" + mapOptions.zoom;
//Loop and add Markers.
staticMapUrl += "&markers=" + document.getElementById('lat').value + "," + document.getElementById('lng').value;
//Display the Image of Google Map.
var imgMap = document.getElementById("imgMap");
$("#imgMap").attr("src", staticMapUrl);
return imgMap + "png";
}
html2canvas
function convertasbinaryimage() {
html2canvas(document.getElementById("map"), {
useCORS: true,
onrendered: function (canvas) {
var img = canvas.toDataURL("image/png");
img = img.replace('data:image/png;base64,', '');
var finalImageSrc = 'data:image/png;base64,' + img;
$('#googlemapbinary').attr('src', finalImageSrc);
}
});
}