Go PNG Decoder

Many file formats are stored and transferred as one-dimensional sequences of bytes. The purpose of a decoder is to transform this stream into a data structure that can be manipulated by a program.

A key component of the image/png package in the Go standard library is the decoder struct, an aggregate data type that collates a PNG data stream into an object that fulfills the image.Image interface.

image.Image provides the color model, dimensions, and pixel coordinates of an image file. A Go program can use this data to transform a PNG prior to encoding it back into a byte stream.

type decoder struct {
	r              io.Reader
	img            image.Image
	crc            hash.Hash32
	width, height  int
	depth          int
	palette        color.Palette
	cb             int
	stage          int
	idatLength     uint32
	tmp            [3 * 256]byte
	interlace      int
	useTransparent bool
	transparent    [6]byte
}
A PNG decoder struct, found within the Go standard library.