smartcrop-gm
This is an adapter module for using smartcrop.js with node.js using gm for image decoding.
Smartcrop-gm requires image magick to be installed and available in $PATH
to function.
Installation
npm install --save smartcrop-gm
API
crop(image, options)
Image: string (path to file) or buffer
Options: options object to be passed to smartcrop
returns: A promise for a cropResult
Example
var request = ;var gm = ;var smartcrop = ; { ;} var src = 'https://raw.githubusercontent.com/jwagner/smartcrop-gm/master/test/flower.jpg';;
Face Detection
Check out smartcrop-cli for a more advanced example of how to use smartcrop from node including face detection with opencv.
Security Considerations
smartcrop-gm is using imagemagick for decoding and resampling images. A number of security issues have been found in imagemagick recently. Make sure that you take the appropriate steps to protect your infrastructure.