HTMLCanvasElement.prototype.toBlob = function(type, quality) {
var dataURL = this.toDataURL(type, quality),
binary = atob( dataURL.substr( dataURL.indexOf(',') + 1 ) ),
i = binary.length,
view = new Uint8Array(i);
while (i--) {
view[i] = binary.charCodeAt(i);
}
return new Blob([view], {type: type});
};
var blob = document.getElementById('mycanvas').toBlob();
// отправляем методом PUT с помощью ajax на save_image.php
save_image.php
<?php
$_SERVER['REQUEST_METHOD'] == 'PUT' || die;
file_put_contents( 'image.png', file_get_contents('php://input') );
?>