···33//// There are printers that can print grayscale or even color, if
44//// you want to do that, you'll need to implement that yourself
55//// and/or leverage the `protocol` module directly.
66-////
77-//// 80mm printers usually have a maximum of 640 dots width.
88-//// There is no validation so please check your image beforehand.
66+////
77+//// 80mm printers usually have a maximum around 600 dots width.
88+//// There is no validation so please check your image width beforehand.
99+////
1010+//// Images need to be supplied in PBM or PGM format. You can use tools like
1111+//// Imagemagick to convert your image. `magick img.png img.pgm`
1212+////
1313+//// ## Example
1414+////
1515+//// ```gleam
1616+//// import escpos/document
1717+//// import escpos/image
1818+//// import simplifile
1919+////
2020+//// // PBM images are already monochrome — just parse and print
2121+//// let assert Ok(pbm) = simplifile.read_bits(from: "./logo.pbm")
2222+//// let assert Ok(img) = image.from_pbm(pbm)
2323+////
2424+//// document.render([document.image(img), document.cut()])
2525+////
2626+//// // PGM images are grayscale and need dithering first
2727+//// let assert Ok(pgm) = simplifile.read_bits(from: "./photo.pgm")
2828+//// let assert Ok(img) = image.from_pgm(pgm)
2929+//// let img = image.dither_ign(img)
3030+////
3131+//// document.render([document.image(img), document.cut()])
3232+//// ```
933////
1034//// Thank you jak for the pgm reading and bayer dithering 💕
1135···126150 dither_bayer(image, bias, bayer_4x4_matrix)
127151}
128152129129-pub fn bayer_2x2_matrix(row: Int, column: Int) -> Int {
153153+fn bayer_2x2_matrix(row: Int, column: Int) -> Int {
130154 case row % 2 + 1, column % 2 + 1 {
131155 1, 1 -> 0
132156 1, 2 -> 127
···137161 }
138162}
139163140140-pub fn bayer_4x4_matrix(row: Int, column: Int) -> Int {
164164+fn bayer_4x4_matrix(row: Int, column: Int) -> Int {
141165 case row % 4 + 1, column % 4 + 1 {
142166 1, 1 -> 0
143167 1, 2 -> 127