The Go Programming Language

Package png

import "image/png"

Package png implements a PNG image decoder and encoder.

The PNG specification is at http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html

Package files

reader.go writer.go

func Decode

func Decode(r io.Reader) (image.Image, os.Error)

Decode reads a PNG image from r and returns it as an image.Image. The type of Image returned depends on the PNG contents.

func DecodeConfig

func DecodeConfig(r io.Reader) (image.Config, os.Error)

DecodeConfig returns the color model and dimensions of a PNG image without decoding the entire image.

func Encode

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

Encode writes the Image m to w in PNG format. Any Image may be encoded, but images that are not image.NRGBA might be encoded lossily.

type FormatError

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

type FormatError string

func (FormatError) String

func (e FormatError) String() string

type IDATDecodingError

An IDATDecodingError wraps an inner error (such as a ZLIB decoding error) encountered while processing an IDAT chunk.

type IDATDecodingError struct {
    Err os.Error
}

func (IDATDecodingError) String

func (e IDATDecodingError) String() string

type UnsupportedError

An UnsupportedError reports that the input uses a valid but unimplemented PNG feature.

type UnsupportedError string

func (UnsupportedError) String

func (e UnsupportedError) String() string

release.r60.3. Except as noted, this content is licensed under a Creative Commons Attribution 3.0 License.