mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-14 01:46:18 -07:00
fix(extract): detect area options
This commit is contained in:
parent
7e58e95fd4
commit
ad7f767e6a
1 changed files with 1 additions and 1 deletions
|
|
@ -143,7 +143,7 @@ func extractImage(image *C.struct__VipsImage, o Options) (*C.struct__VipsImage,
|
||||||
left, top := (o.Width-inWidth)/2, (o.Height-inHeight)/2
|
left, top := (o.Width-inWidth)/2, (o.Height-inHeight)/2
|
||||||
image, err = vipsEmbed(image, left, top, o.Width, o.Height, o.Extend)
|
image, err = vipsEmbed(image, left, top, o.Width, o.Height, o.Extend)
|
||||||
break
|
break
|
||||||
case o.Top > 0 && o.Left > 0:
|
case o.Top > 0 || o.Left > 0:
|
||||||
if o.AreaWidth == 0 || o.AreaHeight == 0 {
|
if o.AreaWidth == 0 || o.AreaHeight == 0 {
|
||||||
err = errors.New(fmt.Sprintf("Invalid area to extract %dx%d", o.AreaWidth, o.AreaHeight))
|
err = errors.New(fmt.Sprintf("Invalid area to extract %dx%d", o.AreaWidth, o.AreaHeight))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue