Last active
August 29, 2015 14:24
-
-
Save h2non/7a8d1da29fafc59ccb05 to your computer and use it in GitHub Desktop.
Gist for issue: https://github.com/h2non/bimg/issues/44. Run: go run bimg-test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"gopkg.in/h2non/bimg.v0" | |
"os" | |
) | |
const operations = 10000 | |
func main() { | |
buffer, err := bimg.Read("image.jpg") | |
if err != nil { | |
fmt.Fprintln(os.Stderr, err) | |
} | |
options := bimg.Options{ | |
Width: 200, | |
Height: 200, | |
Crop: true, | |
Interpolator: bimg.BICUBIC, | |
Gravity: bimg.CENTRE, | |
Quality: 90, | |
} | |
options.Type = bimg.DetermineImageType(buffer) | |
for i := 0; i < operations; i += 1 { | |
_, err := bimg.NewImage(buffer).Process(options) | |
if err != nil { | |
fmt.Fprintln(os.Stderr, err) | |
break | |
} | |
fmt.Printf("Converting image: %d\n", i) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment