Skip to content

image.png #

image.png

PNG decoding, configuration inspection, and lossless eight-bit RGBA encoding. Importing this module registers PNG with image.decode. See image for examples and limits.

Apple optimized PNGs containing a CgBI chunk are unsupported. Both decoding and configuration inspection return an error for them.

fn decode #

fn decode(reader io.Reader) !image.Image

decode reads a PNG into an eight-bit, non-premultiplied NRGBA image.

fn decode_config #

fn decode_config(reader io.Reader) !image.Config

decode_config reads the color model and dimensions without decompressing pixels.

fn encode #

fn encode(mut writer io.Writer, img image.Image) !

encode writes img as a lossless, eight-bit RGBA PNG to writer.

fn encode_to_bytes #

fn encode_to_bytes(img image.Image) ![]u8

encode_to_bytes encodes img as a lossless, eight-bit RGBA PNG.