Skip to main content

Module png

Module png 

Source
Expand description

PNG images (ISO/IEC 15948): a lossless codec and file helpers.

Decoding supports every standard colour type (greyscale, RGB, palette, grey + alpha, RGBA) at every bit depth, all five scanline filters, Adam7 interlacing and palette transparency (tRNS, which expands a palette image to RGBA). Samples come out as 8 bits, or 16 bits for 16-bit images; low bit-depth greyscale is scaled to 8 bits. Encoding writes non-interlaced 8- or 16-bit greyscale, grey + alpha, RGB or RGBA, choosing a filter per row by the usual minimum-sum-of-absolute-differences heuristic, compressed with crate::deflate.

See the book entry Image files.

Structs§

RasterImage
A raster image with interleaved samples, shared by the lossless formats.

Functions§

png_decode
Decodes a PNG byte stream.
png_encode
Encodes an image as PNG (zlib level 0 to 9).
read_png_file
Reads a PNG file.
write_png_file
Writes a PNG file (zlib level 6).