Convert base64 string to image in angular 4

Viewed 10798

I have a requirement where I am cropping the image using ng2-image cropper. But the output is of base64, I want to convert it to image source as I have to send it to some server. I have searched but didn't found anything compatible with angular 4 .

2 Answers

Please try this another simple way to convert base64 to blob

   fetch(base64)
    .then(res => {
      return res.blob();
    })
    .then(blob => {
      console.log(blob);
    });
Related