The API will return BASE64 string format of Image. You can add "data:image/png;base64," prefix and set to src attribute, it will be shown as html5 data uri image.
If you want to mock a html5 File Object to upload or do some other things. There is the code:
var imgData = window.macgap.clipboard.pasteImage();
if (!imgData) return;
var byteString = window.atob(imgData);
var ia = new Uint8Array(byteString.length);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
var file = new Blob([ia], {type: 'image/png', encoding: 'utf-8'});
The API will return BASE64 string format of Image. You can add "data:image/png;base64," prefix and set to src attribute, it will be shown as html5 data uri image.
If you want to mock a html5 File Object to upload or do some other things. There is the code: