Compare commits
2 Commits
feat/print
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0383b4e8cc | ||
| a1ae6fc282 |
4
.env
4
.env
@@ -11,8 +11,8 @@ PHOTOBOOTH_PRINTER=/dev/usb/lp0
|
||||
PHOTOBOOTH_PRINTER_DOTS=576
|
||||
|
||||
# Mid-tone brightening before dithering, offsetting thermal dot gain
|
||||
# (1.8-2.5 is typical; 1 disables it).
|
||||
PHOTOBOOTH_PRINTER_GAMMA=2.0
|
||||
# (1.8-3.0 is typical; 1 disables it).
|
||||
PHOTOBOOTH_PRINTER_GAMMA=2.7
|
||||
|
||||
# Head energy in percent of rated (70-130) and print speed: quality (120 mm/s),
|
||||
# low (150), silent (180) or high (200). Both are SII RP-D10 commands (DC2 ~
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
//! of 8. Defaults to 576 (80 mm paper); use 384 for 58 mm paper.
|
||||
//! - `PHOTOBOOTH_PRINTER_GAMMA`: mid-tone brightening applied before dithering
|
||||
//! to offset the dot gain of thermal paper (`out = in^(1/gamma)`). Defaults to
|
||||
//! 2.0; typical values are 1.8-2.5, and 1 disables it.
|
||||
//! 2.7; typical values are 1.8-3.0, and 1 disables it.
|
||||
//! - `PHOTOBOOTH_PRINTER_DENSITY`: thermal head energy in percent of the rated
|
||||
//! energy, 70-130 (SII `DC2 ~ n`). Unset by default.
|
||||
//! - `PHOTOBOOTH_PRINTER_SPEED`: `quality` (120 mm/s), `low` (150 mm/s),
|
||||
@@ -62,7 +62,7 @@ use crate::{
|
||||
|
||||
const DEFAULT_PRINTER: &str = "/dev/usb/lp0";
|
||||
const DEFAULT_DOTS: usize = 576;
|
||||
const DEFAULT_GAMMA: f32 = 2.0;
|
||||
const DEFAULT_GAMMA: f32 = 2.7;
|
||||
const DENSITY_RANGE: std::ops::RangeInclusive<u8> = 70..=130;
|
||||
/// CLAHE settings: contrast limit and tiles across the image.
|
||||
const CLAHE_CLIP_LIMIT: f64 = 2.0;
|
||||
@@ -603,7 +603,7 @@ mod tests {
|
||||
let printer = Printer::from_values(None, None, None).unwrap();
|
||||
assert_eq!(printer.target, Target::Device("/dev/usb/lp0".into()));
|
||||
assert_eq!(printer.dots, 576);
|
||||
assert_eq!(printer.gamma, 2.0);
|
||||
assert_eq!(printer.gamma, 2.7);
|
||||
// Unparsable widths fall back; valid ones are rounded to whole bytes.
|
||||
let dots = |value| Printer::from_values(None, Some(value), None).unwrap().dots;
|
||||
assert_eq!(dots("wide"), 576);
|
||||
@@ -611,8 +611,8 @@ mod tests {
|
||||
// Gamma must be a positive number.
|
||||
let gamma = |value| Printer::from_values(None, None, Some(value)).unwrap().gamma;
|
||||
assert_eq!(gamma(" 2.4 "), 2.4);
|
||||
assert_eq!(gamma("0"), 2.0);
|
||||
assert_eq!(gamma("bright"), 2.0);
|
||||
assert_eq!(gamma("0"), 2.7);
|
||||
assert_eq!(gamma("bright"), 2.7);
|
||||
// An explicitly empty printer disables printing.
|
||||
assert!(Printer::from_values(Some(""), None, None).is_none());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user