// Converts canvas to an image
function convertCanvasToImage(canvas) {
     var image = new Image();
     image.src = canvas.toDataURL("image/png");
     return image;
}
// Converts image to canvas; returns new canvas element
function convertImageToCanvas(image) {
     var canvas = document.createElement("canvas");
     canvas.width = image.width;
     canvas.height = image.height;
     canvas.getContext("2d").drawImage(image, 0, 0);
     return canvas;
}
作者 铁血 汉子 2017年10月20日
2018/01/21/04:23:19am 2017/10/20/4:19:09
0 133