mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-13 09:20:29 -07:00
Merge pull request #226 from muxinc/fix-flip-and-flop-axes
Fixes #225 by correcting the flip and flop directions
This commit is contained in:
commit
4763cabc0c
1 changed files with 5 additions and 8 deletions
13
resizer.go
13
resizer.go
|
|
@ -291,7 +291,6 @@ func extractOrEmbedImage(image *C.VipsImage, o Options) (*C.VipsImage, error) {
|
||||||
func rotateAndFlipImage(image *C.VipsImage, o Options) (*C.VipsImage, bool, error) {
|
func rotateAndFlipImage(image *C.VipsImage, o Options) (*C.VipsImage, bool, error) {
|
||||||
var err error
|
var err error
|
||||||
var rotated bool
|
var rotated bool
|
||||||
var direction Direction = -1
|
|
||||||
|
|
||||||
if o.NoAutoRotate == false {
|
if o.NoAutoRotate == false {
|
||||||
rotation, flip := calculateRotationAndFlip(image, o.Rotate)
|
rotation, flip := calculateRotationAndFlip(image, o.Rotate)
|
||||||
|
|
@ -309,16 +308,14 @@ func rotateAndFlipImage(image *C.VipsImage, o Options) (*C.VipsImage, bool, erro
|
||||||
}
|
}
|
||||||
|
|
||||||
if o.Flip {
|
if o.Flip {
|
||||||
direction = Horizontal
|
|
||||||
} else if o.Flop {
|
|
||||||
direction = Vertical
|
|
||||||
}
|
|
||||||
|
|
||||||
if direction != -1 {
|
|
||||||
rotated = true
|
rotated = true
|
||||||
image, err = vipsFlip(image, direction)
|
image, err = vipsFlip(image, Vertical)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if o.Flop {
|
||||||
|
rotated = true
|
||||||
|
image, err = vipsFlip(image, Horizontal)
|
||||||
|
}
|
||||||
return image, rotated, err
|
return image, rotated, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue