Render PBM and PGM images in Gleam
gleam add netpbm@2import 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.