Error saving image to the gallery in Ionic?


I am using Base64 To Gallery plugin to store my base64 image to gallery.

This is my code:

 savePhoto() {
      res => {
        this.base64ToGallery.base64ToGallery(res.URI, { prefix: '_bilar', mediaScanner: true }).then(
          res => {
            alert('Saved image to gallery ' + res);
            this.base64value = res.URI;
          err => alert('Error saving image to gallery ' + err)

The error which I am getting is:

The image could not be decoded.

My requirement is save the generated screenshot to my gallery. How do I do that? Any help would be much appreciated. Thank You!