Store as Png Image from Signature pad?

i have implemented signature-pad and its working perfectly…!
now, I want to store the Signature as .png image to local/cloudinary.

$scope.saveCanvas = function() { var sigImg = signaturePad.toDataURL('image/png'); $scope.signature = sigImg; console.log("$scope.signature :",$scope.signature); }

above code gives base64 string like :

How can I convert the base64 into .png image?

i have asked on StackOverFlow also…?

I’m saying this with no direct experience but if you are able to convert the base64 string to a byte array, you should be able to then write it to a file using the cordova file plugin

OK on looking I see you can convert base64 to blob, so that should theoretically do it

I had same issue and here is the solution:

this.signature = this.signaturePad.toDataURL();

  sessionStorage.setItem("Signature", this.signature);

  this.Base64Signature = this.signature.replace(/^data:image\/(png|jpg);base64,/, "");'savedSignature', this.signature);