Adding basic smartcrop support.

Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
This commit is contained in:
Yoan Blanc 2017-04-04 10:17:01 +02:00
parent 24d84e6d8c
commit 9c914467b3
No known key found for this signature in database
GPG key ID: 6058CF4574298812
7 changed files with 58 additions and 3 deletions

View file

@ -41,6 +41,17 @@ func (i *Image) ResizeAndCrop(width, height int) ([]byte, error) {
return i.Process(options)
}
// SmartCrop produces a thumbnail aiming at focus on the interesting part.
func (i *Image) SmartCrop(width, height int) ([]byte, error) {
options := Options{
Width: width,
Height: height,
Crop: true,
SmartCrop: true,
}
return i.Process(options)
}
// Extract area from the by X/Y axis in the current image.
func (i *Image) Extract(top, left, width, height int) ([]byte, error) {
options := Options{