Licence
MIT
Version
1.0.0
Deps
2
Vulns
0
Weekly
0
crop-image
Crop an image using the browser's canvas element
Installation
$ npm install @f/crop-image
Usage
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