0
Object {imageFormat: "image/jpeg", imageB64: "/9j/4AAQ...="}
imageB64: "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBD..."
imageFormat: "image/jpeg"

I have an image object as above. I printed it out using

console.log(result);

It is pretty obvious that it is in base64.

What I want to do is to save this image onto my file system so that i can analyse it. I want to be able to find out the quality and size of this image as it was taken by my webcam and cropped.

Ming Jin
  • 331
  • 1
  • 5
  • 17
  • Check this: http://stackoverflow.com/questions/16968945/convert-base64-png-data-to-javascript-file-objects – Paweł Głowacz Jul 15 '16 at 08:24
  • @PawełGłowacz So am I supposed to convert it into a blob object before I can save it? – Ming Jin Jul 15 '16 at 08:30
  • Sounds valid to me. Of course you can make image from this base64 and hide in some div and use 3rd party like html2canvas check this answer: http://stackoverflow.com/questions/33668608/generate-an-image-of-a-div-and-save-as/33669243#33669243 – Paweł Głowacz Jul 15 '16 at 08:35
  • @PawełGłowacz I keep getting an error, it says the download has failed and that there is no file, I did the following. `
    downloadURI(result, "myImage.jpeg");
    ` `

    function downloadURI(uri, name) { var link = document.createElement("a"); link.download = name; link.href = uri; link.click(); //after creating link you should delete dynamic link //clearDynamicLink(link); }
    `
    – Ming Jin Jul 15 '16 at 08:44
  • @PawełGłowacz this is result. result = Object {imageFormat: "image/jpeg", imageB64: "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAw…rsepzVViSTRRUoxYoZgpwaUsdo57UUVstiBFY5PNFFFIs/9k="} – Ming Jin Jul 15 '16 at 08:58
  • Bumps for answers pls – Ming Jin Jul 20 '16 at 03:18
  • @PawełGłowacz Need some assistance here – Ming Jin Jul 21 '16 at 02:42

0 Answers0