1.0.0 • Published 9 years ago
@f/crop-image v1.0.0
crop-image
Crop an image using the browser's canvas element
Installation
$ npm install @f/crop-imageUsage
var cropImage = require('@f/crop-image')
function cropAndUpload (img, x, y, width, height) {
  const blob = cropImage(img, x, y, width, height)
  return upload(blob)
}API
cropImage(arg)
imgan<img>elementxthe distance along the x axis to begin croppingythe distance along the y axis to begin croppingwidththe width of the section you want to cropheightthe height of the section you want to cropscaleWidthscale the final image up/down to this width (optional - defaults towidth)scaleHeightscale the final image up/down to this height (optional - defaults toheight)
Returns: A blob containing the cropped image data
License
MIT
1.0.0
9 years ago