We could add a new object to handle image things.
For example,
Base64ImageHelper.prototype = {
  saveAsFile: function(path, filename) {},
  generateDiffImage: function(baseImage, compareImage) {}
};