cropping_test.go 369 B

12345678910111213141516171819202122
  1. package images
  2. import (
  3. "bytes"
  4. "os"
  5. "testing"
  6. "github.com/seaweedfs/seaweedfs/weed/util"
  7. )
  8. func TestCropping(t *testing.T) {
  9. fname := "sample1.jpg"
  10. dat, _ := os.ReadFile(fname)
  11. cropped, _ := Cropped(".jpg", bytes.NewReader(dat), 1072, 932, 1751, 1062)
  12. buf := new(bytes.Buffer)
  13. buf.ReadFrom(cropped)
  14. util.WriteFile("cropped1.jpg", buf.Bytes(), 0644)
  15. }