Conversation
…he width has to be inputted in pixels
autodetect paper?
Add StatusInfoRequest to read_status so it doesn't wait forever
marcoSchr
left a comment
There was a problem hiding this comment.
Can you clean up your changes by checking cargo clippy
| fn img_to_lines(img: ImageBuffer<Rgba<u8>, Vec<u8>>) -> Result<Vec<[u8; 90]>, BrotherQlError> { | ||
| fn img_to_lines( | ||
| img: ImageBuffer<Rgba<u8>, Vec<u8>>, | ||
| image_width: u32, |
There was a problem hiding this comment.
We should not need the image width here, as img.width() is the same size
| use std::env; | ||
|
|
There was a problem hiding this comment.
Remove the unused import
| for x in 0..img.width() { | ||
| let i = img.get_pixel(x, y).0[0]; | ||
|
|
||
| let x = x + padding; |
There was a problem hiding this comment.
This can be simplified by using for x in padding..720 {
| /// Get the pixel width (print area width in dots) for the loaded media | ||
| pub fn pixel_width(&self) -> Option<u16> { | ||
| match (self.media_width, self.media_length) { | ||
| // Endless tapes (length = 0) - dots_total - offset_r |
There was a problem hiding this comment.
If this is not only the total width, but there is also an offset, would it make sense to include the offset in the return value?
| (58, 58) => Some(688 - 51), // 637 | ||
|
|
||
| // Unknown media | ||
| _ => None, |
There was a problem hiding this comment.
We should be able to capture width and height here and at least log an error or a warning, that we were unable to determine the width.
| dithered_img.save("/tmp/out_processed.png")?; | ||
|
|
||
| let lines = img_to_lines(dithered_img)?; | ||
| // if the paper format is not known, assume the biggest one |
There was a problem hiding this comment.
Should this comment not be part of line 145?
|
|
||
| let new_width = 720; //630 per la carta piccola | ||
|
|
||
| // let new_width = 720; //630 per la carta piccola |
There was a problem hiding this comment.
Remove this line instead of commenting out
| teloxide-core = "0.13" | ||
| thiserror = "2.0.16" | ||
| tokio = { version = "1.34.0", features = ["full"] } | ||
| openssl = { version = "0.10", features = ["vendored"] } |
There was a problem hiding this comment.
Why is there a new dependency for openssl, when it is never used by us directly?
There was a problem hiding this comment.
Then we probably want to put it with the vendored feature behind a feature, as not everyone would want the statically linked openssl
|
I don't have the mental bandwidth to review this, I'll merge when @marcoSchr approves |
added the ability to auto-detect the tape size by interrogating the printer before each print