ico

package module
v0.0.0-...-1c25f69 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2016 License: MIT Imports: 10 Imported by: 2

README

go-ico

A library for parsing and working with .ico image files. Compatible with Go’s standard image library.

NOTE: This library is not being maintained and might not fully work anymore.

Installation

go get github.com/dkua/go-ico

Dependencies

There is a single dependency on github.com/jsummers/gobmp, a library for working with .bmp files in Go. There is no builtin support for .bmp in the image package, there is an experimental library in image/x/bmp but it is not very good.

Usage

reader, err := os.Open("example.ico")
if err != nil {
        log.Fatal(err)
}
defer reader.Close()

// To decode and return the first (and usually largest) image of an .ico image
image, err := Decode(r)  // image is of image.Image type
if err != nil {
        log.Fatal(err)
}

// To decode and return all the images of an .ico image
ic, err := DecodeAll(r)  // ic is a custom ico.ICO containing an array of image.Image
if err != nil {
        log.Fatal(err)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(r io.Reader) (image.Image, error)

func DecodeConfig

func DecodeConfig(r io.Reader) (image.Config, error)

func Encode

func Encode(w io.Writer, m image.Image) error

Types

type FormatError

type FormatError string

A FormatError reports that the input is not a valid ICO.

func (FormatError) Error

func (e FormatError) Error() string

type ICO

type ICO struct {
	Num   int           // Total number of images
	Image []image.Image // The images themselves
}

ICO represents the possibly multiple images stored in a ICO file.

func DecodeAll

func DecodeAll(r io.Reader) (*ICO, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL