Below Code convert the image file to base64 which can be used to compare image etc .



 var imgvar = new Image();
        imgvar.src = SourceOfFile;
        imgvar.onload = function () {              
         var canvas = document.createElement("canvas");
         canvas.width = this.width;
         canvas.height = this.height;
     
         var ctx = canvas.getContext("2d");
         ctx.drawImage(this, 0, 0);
         var dataURL = canvas.toDataURL("image/png");
      var base64Image = dataURL.replace(/^data:image\/(png|jpg);base64,/, "");

Thanks





SOURCE : JUST2CODE.IN Subscribe to our YouTube channel : https://www.youtube.com/user/TheRussell2012