Auto resize image to 768x64
Using http://github.com/nfnt/resize to resize banners
This commit is contained in:
@@ -7,6 +7,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/nfnt/resize"
|
||||||
|
|
||||||
gim "github.com/ozankasikci/go-image-merge"
|
gim "github.com/ozankasikci/go-image-merge"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -85,10 +87,14 @@ func CreateBanner(portalhex string, savename string, vopt int) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resize banner 768x64
|
||||||
|
nuimg := resize.Resize(768, 64, rgba, resize.Lanczos3)
|
||||||
|
|
||||||
// save the output to png
|
// save the output to png
|
||||||
fmt.Printf("Saving %s to %s\n", portalhex, savename)
|
fmt.Printf("Saving %s to %s\n", portalhex, savename)
|
||||||
file, err := os.Create(savename)
|
file, err := os.Create(savename)
|
||||||
err = png.Encode(file, rgba)
|
err = png.Encode(file, nuimg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user