mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-09 07:28:44 -07:00
Add support for 45° rotation.
This commit is contained in:
parent
66f3ccc217
commit
00fee003f7
4 changed files with 44 additions and 10 deletions
26
vips_test.go
26
vips_test.go
|
|
@ -42,16 +42,26 @@ func TestVipsSave(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestVipsRotate(t *testing.T) {
|
||||
image, _, _ := vipsRead(readImage("test.jpg"))
|
||||
|
||||
newImg, err := vipsRotate(image, D90)
|
||||
if err != nil {
|
||||
t.Fatal("Cannot save the image")
|
||||
files := []struct {
|
||||
name string
|
||||
rotate Angle
|
||||
}{
|
||||
{"test.jpg", D90},
|
||||
{"test_square.jpg", D45},
|
||||
}
|
||||
|
||||
buf, _ := vipsSave(newImg, vipsSaveOptions{Quality: 95})
|
||||
if len(buf) == 0 {
|
||||
t.Fatal("Empty image")
|
||||
for _, file := range files {
|
||||
image, _, _ := vipsRead(readImage(file.name))
|
||||
|
||||
newImg, err := vipsRotate(image, file.rotate)
|
||||
if err != nil {
|
||||
t.Fatal("Cannot rotate the image")
|
||||
}
|
||||
|
||||
buf, _ := vipsSave(newImg, vipsSaveOptions{Quality: 95})
|
||||
if len(buf) == 0 {
|
||||
t.Fatal("Empty image")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue