You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
369 B

  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. }