netpbm

Render PBM and PGM images in Gleam

Package Version Hex Docs

gleam add netpbm@1
import netpbm
import simplifile

pub fn main() -> Nil {
  let pgm =
    netpbm.simple_render_pgm(width: 510, height: 255, pixel: fn(x, y) {
      // Render a gradiant from top-left to bottom-right
      { x / 2 + y } / 2
    })
  let assert Ok(_) = simplifile.write_bits("out2.pgm", pgm)
}

Further documentation can be found at https://hexdocs.pm/netpbm.

Search Document