We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
my result is below.
goos: linux goarch: amd64 pkg: test cpu: AMD Ryzen 7 3700X 8-Core Processor BenchmarkMyCrop-16 14307 79645 ns/op BenchmarkResizeCrop-16 134 8771603 ns/op
my test code is below.
const size = 50 func BenchmarkMyCrop(b *testing.B) { f, err := ioutil.ReadFile("img.png") if err != nil { panic(err) } dImage, _, err := image.Decode(bytes.NewReader(f)) if err != nil { panic(err) } rect := image.Rect(0, 0, size, size) SubImage := func (img image.Image, r image.Rectangle) image.Image { var bgSize = image.Rect(0, 0, r.Dx(), r.Dy()) var bg = image.NewNRGBA(bgSize) draw.Draw(bg, bg.Bounds(), img, r.Min, draw.Src) return bg } for i := 0; i < b.N; i++ { SubImage(dImage, rect) } } func BenchmarkResizeCrop(b *testing.B) { f, err := ioutil.ReadFile("img.png") if err != nil { panic(err) } dImage, _, err := image.Decode(bytes.NewReader(f)) if err != nil { panic(err) } rect := image.Rect(0, 0, size, size) for i := 0; i < b.N; i++ { transform.Crop(dImage, rect) } }
my test image is below.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
my result is below.
my test code is below.
my test image is below.
The text was updated successfully, but these errors were encountered: