resizing_test.go 345 B

12345678910111213141516171819202122
  1. package images
  2. import (
  3. "bytes"
  4. "os"
  5. "testing"
  6. )
  7. func TestResizing(t *testing.T) {
  8. fname := "sample2.webp"
  9. dat, _ := os.ReadFile(fname)
  10. resized, _, _ := Resized(".webp", bytes.NewReader(dat), 100, 30, "")
  11. buf := new(bytes.Buffer)
  12. buf.ReadFrom(resized)
  13. os.WriteFile("resized1.png", buf.Bytes(), 0644)
  14. os.Remove("resized1.png")
  15. }