-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
29 lines (24 loc) · 891 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
package main
import (
"flag"
"log"
"os"
lib "github.com/barelyhuman/og-image/lib"
)
func main() {
title := flag.String("title", "", "Title")
subTitle := flag.String("desc", "", "Description or Sub Title")
fontSize := flag.Int("size-one", 16, "Font Size for title")
subFontSize := flag.Int("size-two", 12, "Font Size For description")
color := flag.String("color", "#000", "Font Color")
backgroundImageURL := flag.String("background-url", "", "URL for the background")
backgroundImageColor := flag.String("background-color", "", "hex for the background")
outFile := flag.String("out", "./og-image.png", "File to output to, will export a png")
flag.Parse()
file, err := os.Create(*outFile)
if err != nil {
log.Fatal(err)
}
img := lib.DrawImage(*title, *subTitle, *fontSize, *subFontSize, *color, *backgroundImageURL, *backgroundImageColor)
lib.WriteImage(file, img)
}