BitmapData to PNG

You won’t need to base64-encode if you are saving on the desktop, but if you are sending to a server you may need to base64-encode, or convert to an ArrayBuffer for filesaver.js on HTML5: