seaweedfs/weed/images/resizing_test.go

24 lines
391 B
Go
Raw Normal View History

2021-07-24 13:26:40 +08:00
package images
import (
"bytes"
"github.com/seaweedfs/seaweedfs/weed/util"
2021-07-24 13:26:40 +08:00
"os"
"testing"
)
func TestResizing(t *testing.T) {
fname := "sample2.webp"
dat, _ := os.ReadFile(fname)
2021-07-24 13:26:40 +08:00
resized, _, _ := Resized(".webp", bytes.NewReader(dat), 100, 30, "")
buf := new(bytes.Buffer)
buf.ReadFrom(resized)
2022-02-05 13:32:27 +08:00
util.WriteFile("resized1.png", buf.Bytes(), 0644)
2021-07-24 13:26:40 +08:00
os.Remove("resized1.png")
}