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