Categorygithub.com/ArtificialLegacy/go-ico
repositorypackage
0.0.0-20240905165543-df31b047e3f7
Repository: https://github.com/artificiallegacy/go-ico.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

goico

Implements basic support for encoding and decoding ICO files.

Supported

  • .ico and .cur
  • BMP Images
  • 32bit Alpha
  • CUR Hotspots

Unsupported

  • PNG Images

Usage

Config Decoding

f, err := os.Open("favicon.ico")
if err != nil {
    panic(err)
}
defer f.Close()

config, err := goico.DecodeConfig(f)
if err != nil {
    panic(err)
}

Decoding

f, err := os.Open("favicon.ico")
if err != nil {
    panic(err)
}
defer f.Close()

config, imgs, err := goico.Decode(f)
if err != nil {
    panic(err)
}

Encoding

f, err := os.Create("favicon.ico")
if err != nil {
    panic(err)
}
defer f.Close()

imgs := []image.Image{...} // images with a max size of 256x256
ico, err := goico.NewICOConfig(imgs)
if err != nil {
    panic(err)
}

err = goico.Encode(f, ico, imgs)
if err != nil {
    panic(err)
}