Created
May 7, 2016 09:40
-
-
Save jakalada/0410dcf3276b83dc475aea4634bd3ad9 to your computer and use it in GitHub Desktop.
ElectronでCanvasの描画内容を画像ファイルとして保存する ref: http://qiita.com/jakalada/items/6f62b2089a67a04514b7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function saveCanvas () { | |
const canvasDataUrl = myCanvas.toDataURL() | |
const decoded = dataUriToBuffer(canvasDataUrl) | |
fs.writeFile(imageFilePath, decoded, (err) => { | |
if (err) { | |
window.alert('ファイルの保存に失敗しました') | |
console.log(err) | |
} else { | |
window.alert('ファイルを保存しました') | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment