Package ico implements an ICO file decoder and encoder. Package cur implements a CUR file decoder and encoder.
See https://en.wikipedia.org/wiki/ICO_(file_format) for more information.
Use go get:
go get github.com/sergeymakinen/go-ico
Then import the package into your own code:
import "github.com/sergeymakinen/go-ico"
b, _ := os.ReadFile("icon_32x32-32.png")
m1, _ := png.Decode(bytes.NewReader(b))
b, _ = os.ReadFile("icon_256x256-32.png")
m2, _ := png.Decode(bytes.NewReader(b))
f, _ := os.Create("icon.ico")
ico.EncodeAll(f, []image.Image{m1, m2})
f.Close()
BSD 3-Clause