code: function(imgsrc, width, height, callback) {
      var args = new Args(arguments);
      checkCommonArgs(args);
  
      var Image = Canvas.Image, fs = require("fs");
      var img = new Image();
      img.onerror = function(err) {
          callback(false, err);
      };
      img.onload = function() {
          ratio = Math.min(
              Math.min(img.width, width) / Math.max(img.width, width),
              Math.min(img.height, height) / Math.max(img.height, height)
          );
  
          var w = Math.round(ratio * img.width, 0);
          var h = Math.round(ratio * img.height, 0);
          var canvas = new Canvas(w, h);
          var ctx = canvas.getContext("2d");
          ctx.scale(ratio, ratio);
          ctx.drawImage(img, 0, 0);
          callback(true, canvas);
      };
      if (!isValidFile(imgsrc)) {
          callback(false, new Error (imgsrc + ' is not a valid file'));
      } else {
          img.src = imgsrc;
      }
  }
docs: Resizes an image where longest dimension is the shortest of width/height
  imgsrc - string path to image to crop
  width - integer length of longest width dimension for resized image
  height - integer length of longest height dimension for resized image
  callback - callback function(
  result - boolean true on success
  data - canvas object on success, Error on failure