function updateResults(img, data, keepMetaData) {
    var isCanvas = window.HTMLCanvasElement && img instanceof HTMLCanvasElement
    if (!keepMetaData) {
      removeMetaData()
      if (data) {
        displayMetaData(data)
      }
      if (isCanvas) {
        actionsNode.show()
      } else {
        actionsNode.hide()
      }
    }
    if (!(isCanvas || img.src)) {
      resultNode
        .children()
        .replaceWith($('<span>Loading image file failed</span>'))
      return
    }
    var content = $('<a></a>').append(img)
    resultNode.children().replaceWith(content)
    if (data.imageHead) {
      if (data.exif) {
        // Reset Exif Orientation data:
        loadImage.writeExifData(data.imageHead, data, 'Orientation', 1)
      }
      img.toBlob(function (blob) {
        if (!blob) return
        loadImage.replaceHead(blob, data.imageHead, function (newBlob) {
          content
            .attr('href', loadImage.createObjectURL(newBlob))
            .attr('download', 'image.jpg')
        })
      }, 'image/jpeg')
    }
  }
Updates the results view

@param {*} img Image or canvas element
@param {object} [data] Metadata object
@param {boolean} [keepMetaData] Keep meta data if true