I'm trying to create a image from a video by using a canvas and then sending the image to an API.
This is my code (large parts are omitted for brevity)
var image = new Image();
image.src = canvas.toDataURL("image/png");
var newFile = new File([atob(image.src)], lorem.png, {
type: "image/png",
lastModified: Date.now()
})
image.src is a long string that seems to be in the format base64 data:image/png;base64
[Link to the data ][1]:https://gist.github.com/anonymous/d357e780fa60b2c47490a9f795e34acf
When I try to decode the data into binary with the function atob, I get the following error:
Error: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
It's not clear to me which part of the base64 data are not formatted correctly.