Skip to content Skip to sidebar Skip to footer

Save Html5 Canvas Element To File Using Webos

here img variable is extracted from using Open Source Png Generation code here .. http://www.xarg.org/2010/03/generate-client-side-png-files-using-javascript/ that is an alternati

Solution 1:

data is a string which starts with data:image/png;base64, and the rest is the data in base64.

  1. Remove data:image/png;base64, from data
  2. Convert it from base64 to binary
  3. Save that binary buffer to file

Code

var buff = new Buffer(data.substr('data:image/png;base64,'.length), 'base64');
...
fs.write(id, buff, 0, buff.length, 0, function(...

Post a Comment for "Save Html5 Canvas Element To File Using Webos"