I use html2canvas to turn the javascript API into Google Maps with custom functions, into a canvas and then an image.
It works well in all browsers, except for IE 11, it creates an image with an additional space to the right of the image equal to (browser window width - map width). Thus, the wider my window, the more space on the right, and vice versa.
How can I slice this image (or HTMLcanvas) exactly at the edge of the actual image (768 pixels wide)?

I found this code here, but did not know how to change it for this task:
var image = new Image(); image.onload = cutImageUp; image.src = 'myimage.png'; function cutImageUp() { var imagePieces = []; for(var x = 0; x < numColsToCut; ++x) { for(var y = 0; y < numRowsToCut; ++y) { var canvas = document.createElement('canvas'); canvas.width = widthOfOnePiece; canvas.height = heightOfOnePiece; var context = canvas.getContext('2d'); context.drawImage(image, x * widthOfOnePiece, y * heightOfOnePiece, widthOfOnePiece, heightOfOnePiece, 0, 0, canvas.width, canvas.height); imagePieces.push(canvas.toDataURL()); } }
javascript jquery image google-maps html2canvas
Tetradev
source share