mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-07 21:48:13 -08:00
Adding basic smartcrop support.
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
This commit is contained in:
parent
24d84e6d8c
commit
9c914467b3
7 changed files with 58 additions and 3 deletions
|
|
@ -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)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue