|
|
|
@ -209,7 +209,7 @@ func BenchmarkConvertToJpeg(b *testing.B) {
|
|
|
|
runBenchmarkResize("test.png", options, b)
|
|
|
|
runBenchmarkResize("test.png", options, b)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func BenchmarkCrop(b *testing.B) {
|
|
|
|
func BenchmarkCropJpeg(b *testing.B) {
|
|
|
|
options := Options{
|
|
|
|
options := Options{
|
|
|
|
Width: 800,
|
|
|
|
Width: 800,
|
|
|
|
Height: 600,
|
|
|
|
Height: 600,
|
|
|
|
@ -217,6 +217,22 @@ func BenchmarkCrop(b *testing.B) {
|
|
|
|
runBenchmarkResize("test.jpg", options, b)
|
|
|
|
runBenchmarkResize("test.jpg", options, b)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func BenchmarkCropPng(b *testing.B) {
|
|
|
|
|
|
|
|
options := Options{
|
|
|
|
|
|
|
|
Width: 800,
|
|
|
|
|
|
|
|
Height: 600,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
runBenchmarkResize("test.png", options, b)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func BenchmarkCropWebP(b *testing.B) {
|
|
|
|
|
|
|
|
options := Options{
|
|
|
|
|
|
|
|
Width: 800,
|
|
|
|
|
|
|
|
Height: 600,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
runBenchmarkResize("test.webp", options, b)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func BenchmarkExtractJpeg(b *testing.B) {
|
|
|
|
func BenchmarkExtractJpeg(b *testing.B) {
|
|
|
|
options := Options{
|
|
|
|
options := Options{
|
|
|
|
Top: 100,
|
|
|
|
Top: 100,
|
|
|
|
@ -226,3 +242,83 @@ func BenchmarkExtractJpeg(b *testing.B) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
runBenchmarkResize("test.jpg", options, b)
|
|
|
|
runBenchmarkResize("test.jpg", options, b)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func BenchmarkExtractPng(b *testing.B) {
|
|
|
|
|
|
|
|
options := Options{
|
|
|
|
|
|
|
|
Top: 100,
|
|
|
|
|
|
|
|
Left: 50,
|
|
|
|
|
|
|
|
AreaWidth: 600,
|
|
|
|
|
|
|
|
AreaHeight: 480,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
runBenchmarkResize("test.png", options, b)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func BenchmarkExtractWebp(b *testing.B) {
|
|
|
|
|
|
|
|
options := Options{
|
|
|
|
|
|
|
|
Top: 100,
|
|
|
|
|
|
|
|
Left: 50,
|
|
|
|
|
|
|
|
AreaWidth: 600,
|
|
|
|
|
|
|
|
AreaHeight: 480,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
runBenchmarkResize("test.webp", options, b)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func BenchmarkZoomJpeg(b *testing.B) {
|
|
|
|
|
|
|
|
options := Options{Zoom: 1}
|
|
|
|
|
|
|
|
runBenchmarkResize("test.jpg", options, b)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func BenchmarkZoomPng(b *testing.B) {
|
|
|
|
|
|
|
|
options := Options{Zoom: 1}
|
|
|
|
|
|
|
|
runBenchmarkResize("test.png", options, b)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func BenchmarkZoomWebp(b *testing.B) {
|
|
|
|
|
|
|
|
options := Options{Zoom: 1}
|
|
|
|
|
|
|
|
runBenchmarkResize("test.webp", options, b)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func BenchmarkWatermarkJpeg(b *testing.B) {
|
|
|
|
|
|
|
|
options := Options{
|
|
|
|
|
|
|
|
Watermark: Watermark{
|
|
|
|
|
|
|
|
Text: "Chuck Norris (c) 2315",
|
|
|
|
|
|
|
|
Opacity: 0.25,
|
|
|
|
|
|
|
|
Width: 200,
|
|
|
|
|
|
|
|
DPI: 100,
|
|
|
|
|
|
|
|
Margin: 150,
|
|
|
|
|
|
|
|
Font: "sans bold 12",
|
|
|
|
|
|
|
|
Background: Color{255, 255, 255},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
runBenchmarkResize("test.webp", options, b)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func BenchmarkWatermarPng(b *testing.B) {
|
|
|
|
|
|
|
|
options := Options{
|
|
|
|
|
|
|
|
Watermark: Watermark{
|
|
|
|
|
|
|
|
Text: "Chuck Norris (c) 2315",
|
|
|
|
|
|
|
|
Opacity: 0.25,
|
|
|
|
|
|
|
|
Width: 200,
|
|
|
|
|
|
|
|
DPI: 100,
|
|
|
|
|
|
|
|
Margin: 150,
|
|
|
|
|
|
|
|
Font: "sans bold 12",
|
|
|
|
|
|
|
|
Background: Color{255, 255, 255},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
runBenchmarkResize("test.png", options, b)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func BenchmarkWatermarWebp(b *testing.B) {
|
|
|
|
|
|
|
|
options := Options{
|
|
|
|
|
|
|
|
Watermark: Watermark{
|
|
|
|
|
|
|
|
Text: "Chuck Norris (c) 2315",
|
|
|
|
|
|
|
|
Opacity: 0.25,
|
|
|
|
|
|
|
|
Width: 200,
|
|
|
|
|
|
|
|
DPI: 100,
|
|
|
|
|
|
|
|
Margin: 150,
|
|
|
|
|
|
|
|
Font: "sans bold 12",
|
|
|
|
|
|
|
|
Background: Color{255, 255, 255},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
runBenchmarkResize("test.webp", options, b)
|
|
|
|
|
|
|
|
}
|
|
|
|
|