imgutils v0.1.0 ImgUtils.Formats.PPM View Source

PPM image encoding

Usage

Encoding

image = File.read!("image.jpeg")
{:ok, decoded, props} = Jaypeg.decode(image)
encoded = ImgUtils.Formats.PPM.encode(decoded, props[:width], props[:height])
File.write!("image.ppm", encoded)

Link to this section Summary

Functions

Encode image using PPM format

Link to this section Functions

Link to this function

encode(content, width, height) View Source
encode(binary(), pos_integer(), pos_integer()) :: binary()

Encode image using PPM format

Examples

iex> ImgUtils.Formats.PPM.encode(<<255, 0, 0>>, 1, 1) <<80, 54, 10, 49, 32, 49, 10, 50, 53, 53, 10, 255, 0, 0>>