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

@ -249,6 +249,9 @@ func extractOrEmbedImage(image *C.VipsImage, o Options) (*C.VipsImage, error) {
inHeight := int(image.Ysize)
switch {
case o.SmartCrop:
image, err = vipsSmartCrop(image, o.Width, o.Height)
break
case o.Crop:
width := int(math.Min(float64(inWidth), float64(o.Width)))
height := int(math.Min(float64(inHeight), float64(o.Height)))