🖨️ esc/pos implementation in gleam

chore: add pbm test

okk.moe 8361a99e bb1642b8

verified
+11 -6
+2
.gitignore
··· 2 *.ez 3 /build 4 erl_crash.dump
··· 2 *.ez 3 /build 4 erl_crash.dump 5 + *.pgm 6 + *.pbm
+9 -6
dev/escpos_dev.gleam
··· 5 6 pub fn main() { 7 let assert Ok(raw_pgm) = simplifile.read_bits(from: "./dev/lucy.pgm") 8 9 - let assert Ok(img) = image.from_pgm(raw_pgm) 10 - let img = 11 - img 12 // |> image.dither_ign 13 |> image.dither_bayer4x4(0) 14 15 let assert Ok(printer) = printer.connect("10.219.160.62", 9100) 16 17 escpos.new() 18 - |> escpos.writeln("Hello, World!") 19 - |> escpos.image(img) 20 - |> escpos.writeln("End World!") 21 |> escpos.line_feed(3) 22 |> escpos.cut 23 |> printer.print(printer)
··· 5 6 pub fn main() { 7 let assert Ok(raw_pgm) = simplifile.read_bits(from: "./dev/lucy.pgm") 8 + let assert Ok(raw_pbm) = simplifile.read_bits(from: "./dev/lucy.pbm") 9 10 + let assert Ok(imgpgm) = image.from_pgm(raw_pgm) 11 + let assert Ok(imgpbm) = image.from_pbm(raw_pbm) 12 + let imgpgm = 13 + imgpgm 14 // |> image.dither_ign 15 |> image.dither_bayer4x4(0) 16 + // |> image.dither_bayer2x2(0) 17 18 let assert Ok(printer) = printer.connect("10.219.160.62", 9100) 19 20 escpos.new() 21 + |> escpos.reset 22 + |> escpos.image(imgpgm) 23 + |> escpos.image(imgpbm) 24 |> escpos.line_feed(3) 25 |> escpos.cut 26 |> printer.print(printer)
dev/lucy.pbm

This is a binary file and will not be displayed.