-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
43 lines (34 loc) · 931 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"fmt"
"os"
"strconv"
imageio "github.com/muchq/moonbase/go/images/lib"
images "github.com/muchq/moonbase/go/images/lib"
)
func main() {
path := os.Args[1]
imageData, _, err := imageio.ReadImage(path)
if err != nil {
fmt.Println(err)
return
}
depth, err := parseDepth()
if err != nil {
fmt.Println("invalid depth", err)
return
}
_ = imageio.WriteImageAsPng(imageData, path+".png")
greyBlurXImage := images.BoxBlurX(imageData, 1, depth)
_ = imageio.WriteImageAsPng(&greyBlurXImage, path+".grey.X.png")
greyBlurYImage := images.BoxBlurY(imageData, 1, depth)
_ = imageio.WriteImageAsPng(&greyBlurYImage, path+".grey.Y.png")
greyBlurBoxImage := images.BoxBlur(imageData, 1, depth)
_ = imageio.WriteImageAsPng(&greyBlurBoxImage, path+".grey.Box.png")
}
func parseDepth() (int, error) {
if len(os.Args) < 3 {
return 3, nil // default to 3
}
return strconv.Atoi(os.Args[2])
}