image.internal #
image.internal
Shared implementation helpers for image.png and image.jpeg, using the bundled stb library. Applications should use the codec modules directly.
fn decode #
fn decode(reader io.Reader, magic string) !image.Image
decode reads an eight-bit PNG or JPEG into an independent NRGBA pixel buffer.
fn decode_config #
fn decode_config(reader io.Reader, magic string) !image.Config
decode_config reads a PNG or JPEG header without decompressing its pixels.
fn encode #
fn encode(img image.Image, jpeg bool, quality int) ![]u8
encode converts an image to PNG, or JPEG with the given quality when jpeg is true.
fn write_encoded #
fn write_encoded(mut writer io.Writer, bytes []u8) !
write_encoded writes every encoded byte, including when the writer accepts partial writes.