mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-17 03:06:41 -07:00
fix(resize): support rotate
This commit is contained in:
parent
40dd19fa6a
commit
812532b615
1 changed files with 10 additions and 6 deletions
16
resize.go
16
resize.go
|
|
@ -34,6 +34,8 @@ func Resize(buf []byte, o Options) ([]byte, error) {
|
||||||
return nil, errors.New("Unsupported image output type")
|
return nil, errors.New("Unsupported image output type")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug("Options: %#v", o)
|
||||||
|
|
||||||
// get WxH
|
// get WxH
|
||||||
inWidth := int(image.Xsize)
|
inWidth := int(image.Xsize)
|
||||||
inHeight := int(image.Ysize)
|
inHeight := int(image.Ysize)
|
||||||
|
|
@ -100,12 +102,14 @@ func Resize(buf []byte, o Options) ([]byte, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
rotation, flip := calculateRotationAndFlip(image, o.Rotate)
|
if o.Rotate == 0 {
|
||||||
if flip {
|
rotation, flip := calculateRotationAndFlip(image, o.Rotate)
|
||||||
o.Flip = HORIZONTAL
|
if flip {
|
||||||
}
|
o.Flip = HORIZONTAL
|
||||||
if rotation != D0 {
|
}
|
||||||
o.Rotate = rotation
|
if rotation > D0 {
|
||||||
|
o.Rotate = rotation
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if o.Rotate > 0 {
|
if o.Rotate > 0 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue