code: function getImageFromJpgOrPngFile (file) {
    var filename = file.name
    return new Promise(function(resolve, reject){
  
      var image = new Image()
      var urlCreator = window.URL || window.webkitURL
      var imageUrl = urlCreator.createObjectURL(file)
  
      // event handlers
      image.onload = function () {
        urlCreator.revokeObjectURL(imageUrl)
        resolve(image)
      }
      image.onerror = function (error) {
        urlCreator.revokeObjectURL(imageUrl)
        console.error('Error converting image: ' + filename, error)
        reject('Error converting image: ' + filename)
      }
  
      // initiate loading process
      image.src = imageUrl
  
    })
  }
docs: methods