代码如下:
/** * save canvas content as image */ function saveItAsImage() { var image = $("#myCanvas").get(0).toDataURL("image/png").replace("image/png", "image/octet-stream"); //locally save window.location.href=image; } 源码下载 读者可以去我的 GitHub jPainter 项目下下载,或者直接使用git 工具: https://github.com/LuanLouis/jPainter.git-----------------------------------------------------------------------------------------------------------------------------------------