From 4aec0e4e9a58f47367824d7e21ebee2da487656b Mon Sep 17 00:00:00 2001 From: "bradley.richins" Date: Tue, 20 Oct 2020 19:15:06 -0600 Subject: [PATCH] Auto resize image to 768x64 Using http://github.com/nfnt/resize to resize banners --- glyphbanner.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/glyphbanner.go b/glyphbanner.go index 6948e3f..bc01496 100644 --- a/glyphbanner.go +++ b/glyphbanner.go @@ -7,6 +7,8 @@ import ( "os" "strconv" + "github.com/nfnt/resize" + gim "github.com/ozankasikci/go-image-merge" ) @@ -85,10 +87,14 @@ func CreateBanner(portalhex string, savename string, vopt int) { if err != nil { panic(err) } + + // Resize banner 768x64 + nuimg := resize.Resize(768, 64, rgba, resize.Lanczos3) + // save the output to png fmt.Printf("Saving %s to %s\n", portalhex, savename) file, err := os.Create(savename) - err = png.Encode(file, rgba) + err = png.Encode(file, nuimg) if err != nil { fmt.Println(err) }