func (i *Icon) WriteTo(wr io.Writer) (int64, error) {
	var written int64
	if err := i.encodeImage(); err != nil {
		return written, err
	}
	size, err := i.writeHeader(wr)
	written += size
	if err != nil {
		return written, err
	}
	size, err = i.writeData(wr)
	written += size
	if err != nil {
		return written, err
	}
	return written, nil
}
WriteTo encodes the icon into wr.
package icns
import (
	"bytes"
	"image"
	"image/png"
	"io"
)
type Icon struct {
	Type  OsType
	Image image.Image
	header    [8]byte
	headerSet bool
	data      []byte
}