code: function(size, callback) {
        var ratio = size.width / size.height;
        var cropPosition = {};
        var resizeWidth = width || Math.round(height * ratio);
        var resizeHeight = height || Math.round(width / ratio);
  
        if (crop && width && height) {
          if (ratio < width / height) {
            resizeHeight = Math.round(width / ratio);
            cropPosition = {x: 0, y: Math.round((resizeHeight - height) / 2)};
            crop = resizeHeight > height;
          } else {
            resizeWidth = Math.round(height * ratio);
            cropPosition = {x: Math.round((resizeWidth - width) / 2), y: 0};
            crop = resizeWidth > width;
          }
        }
  
        image
          .noProfile()
          .quality(quality)
          .resizeExact(resizeWidth, resizeHeight);
  
        if (crop)
          image.crop(width, height, cropPosition.x, cropPosition.y);
  
        image.write(thumbnailPath, callback);
      }
docs: Generate thumbnail