Im using deep AI API to make an image a cartoon
await deepai.renderResultIntoElement(result, document.getElementById('RES'));
})();
How can I save that file as well as it be displayed in a RES div? it renderes fine even with updates!
UPDATE:
await deepai.renderResultIntoElement(result, document.getElementById('RES'));
let e=await fetch(result, {
method: 'GET',
headers: {
'Content-Type': 'image',
},
});
let blob=await e.blob();
let url=window.URL.createObjectURL(blob);
let a=document.createElement('a');
a.href=url;
a.download='cartoon.jpeg'; //here goes file name
document.body.appendChild(a);
a.click();
sleep(100);
a.remove();
})()
I also tried let Blob=await response.blob(); that didnt work it just stopped it rendering!
Its nearly there its trying to download to a file but it is saying not correct format upon opening. any ideas?