Encoder configures encoding PNG images. BufferPool optionally specifies a buffer pool to get temporary
EncoderBuffers when encoding an image.CompressionLevelCompressionLevel Encode writes the Image m to w in PNG format.
Note that the exact bytes written to w are not covered by the Go 1
compatibility promise. Callers, including tests, should not depend on the
exact written bytes.
EncoderBufferPool is an interface for getting and returning temporary
instances of the [EncoderBuffer] struct. This can be used to reuse buffers
when encoding multiple images.( EncoderBufferPool) Get() *EncoderBuffer( EncoderBufferPool) Put(*EncoderBuffer)
A FormatError reports that the input is not a valid PNG.( FormatError) Error() string
FormatError : error
var chunkOrderError
An UnsupportedError reports that the input uses a valid but unimplemented PNG feature.( UnsupportedError) Error() string
UnsupportedError : error
cbintcrchash.Hash32depthintheightintidatLengthuint32imgimage.Imageinterlaceintpalettecolor.Paletterio.Readerstageinttmp[768]bytetransparent[6]byte useTransparent and transparent are used for grayscale and truecolor
transparency, as opposed to palette transparency.widthint Read presents one or more IDAT chunks as one continuous stream (minus the
intermediate chunk headers and footers). If the PNG data looked like:
... len0 IDAT xxx crc0 len1 IDAT yy crc1 len2 IEND crc2
then this reader presents xxxyy. For well-formed PNG data, the decoder state
immediately before the first Read call is that d.r is positioned between the
first IDAT and xxx, and the decoder state immediately after the last Read
call is that d.r is positioned between yy and crc1.(*decoder) checkHeader() error decode decodes the IDAT data into an image. mergePassInto merges a single pass into a full sized image.(*decoder) parseChunk(configOnly bool) error(*decoder) parseIDAT(length uint32) (err error)(*decoder) parseIEND(length uint32) error(*decoder) parseIHDR(length uint32) error(*decoder) parsePLTE(length uint32) error(*decoder) parsetRNS(length uint32) error readImagePass reads a single image pass, sized according to the pass number.(*decoder) verifyChecksum() error
*decoder : io.Reader
Package-Level Functions (total 13, in which 3 are exported)
Decode reads a PNG image from r and returns it as an [image.Image].
The type of Image returned depends on the PNG contents.
DecodeConfig returns the color model and dimensions of a PNG image without
decoding the entire image.
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.
Note that the exact bytes written to w are not covered by the Go 1
compatibility promise. Callers, including tests, should not depend on the
exact written bytes.
Chooses the filter to use for encoding the current row, and applies it.
The return value is the index of the filter and also of the row in cr that has had it applied.
filterPaeth applies the Paeth filter to the cdat slice.
cdat is the current row's data, pdat is the previous row's data.
A cb is a combination of color type and bit depth.
A cb is a combination of color type and bit depth.
A cb is a combination of color type and bit depth.
A cb is a combination of color type and bit depth.
A cb is a combination of color type and bit depth.
A cb is a combination of color type and bit depth.
A cb is a combination of color type and bit depth.
A cb is a combination of color type and bit depth.
A cb is a combination of color type and bit depth.
A cb is a combination of color type and bit depth.
A cb is a combination of color type and bit depth.
A cb is a combination of color type and bit depth.
A cb is a combination of color type and bit depth.
A cb is a combination of color type and bit depth.
A cb is a combination of color type and bit depth.
A cb is a combination of color type and bit depth.
Color type, as per the PNG spec.
Color type, as per the PNG spec.
Color type, as per the PNG spec.
Color type, as per the PNG spec.
Color type, as per the PNG spec.
Decoding stage.
The PNG specification says that the IHDR, PLTE (if present), tRNS (if
present), IDAT and IEND chunks must appear in that order. There may be
multiple IDAT chunks, and IDAT chunks must be sequential (i.e. they may not
have any other chunks between them).
https://www.w3.org/TR/PNG/#5ChunkOrdering
Decoding stage.
The PNG specification says that the IHDR, PLTE (if present), tRNS (if
present), IDAT and IEND chunks must appear in that order. There may be
multiple IDAT chunks, and IDAT chunks must be sequential (i.e. they may not
have any other chunks between them).
https://www.w3.org/TR/PNG/#5ChunkOrdering
Decoding stage.
The PNG specification says that the IHDR, PLTE (if present), tRNS (if
present), IDAT and IEND chunks must appear in that order. There may be
multiple IDAT chunks, and IDAT chunks must be sequential (i.e. they may not
have any other chunks between them).
https://www.w3.org/TR/PNG/#5ChunkOrdering
Decoding stage.
The PNG specification says that the IHDR, PLTE (if present), tRNS (if
present), IDAT and IEND chunks must appear in that order. There may be
multiple IDAT chunks, and IDAT chunks must be sequential (i.e. they may not
have any other chunks between them).
https://www.w3.org/TR/PNG/#5ChunkOrdering
Decoding stage.
The PNG specification says that the IHDR, PLTE (if present), tRNS (if
present), IDAT and IEND chunks must appear in that order. There may be
multiple IDAT chunks, and IDAT chunks must be sequential (i.e. they may not
have any other chunks between them).
https://www.w3.org/TR/PNG/#5ChunkOrdering
Decoding stage.
The PNG specification says that the IHDR, PLTE (if present), tRNS (if
present), IDAT and IEND chunks must appear in that order. There may be
multiple IDAT chunks, and IDAT chunks must be sequential (i.e. they may not
have any other chunks between them).
https://www.w3.org/TR/PNG/#5ChunkOrdering