fix: raise the default print gamma to 2.7 for brighter photos

This commit was merged in pull request #5.
This commit is contained in:
bankosegger
2026-11-20 18:59:37 +01:00
parent a1ae6fc282
commit 0383b4e8cc
2 changed files with 7 additions and 7 deletions

4
.env
View File

@@ -11,8 +11,8 @@ PHOTOBOOTH_PRINTER=/dev/usb/lp0
PHOTOBOOTH_PRINTER_DOTS=576 PHOTOBOOTH_PRINTER_DOTS=576
# Mid-tone brightening before dithering, offsetting thermal dot gain # Mid-tone brightening before dithering, offsetting thermal dot gain
# (1.8-2.5 is typical; 1 disables it). # (1.8-3.0 is typical; 1 disables it).
PHOTOBOOTH_PRINTER_GAMMA=2.0 PHOTOBOOTH_PRINTER_GAMMA=2.7
# Head energy in percent of rated (70-130) and print speed: quality (120 mm/s), # 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 ~ # low (150), silent (180) or high (200). Both are SII RP-D10 commands (DC2 ~

View File

@@ -10,7 +10,7 @@
//! of 8. Defaults to 576 (80 mm paper); use 384 for 58 mm paper. //! of 8. Defaults to 576 (80 mm paper); use 384 for 58 mm paper.
//! - `PHOTOBOOTH_PRINTER_GAMMA`: mid-tone brightening applied before dithering //! - `PHOTOBOOTH_PRINTER_GAMMA`: mid-tone brightening applied before dithering
//! to offset the dot gain of thermal paper (`out = in^(1/gamma)`). Defaults to //! 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 //! - `PHOTOBOOTH_PRINTER_DENSITY`: thermal head energy in percent of the rated
//! energy, 70-130 (SII `DC2 ~ n`). Unset by default. //! energy, 70-130 (SII `DC2 ~ n`). Unset by default.
//! - `PHOTOBOOTH_PRINTER_SPEED`: `quality` (120 mm/s), `low` (150 mm/s), //! - `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_PRINTER: &str = "/dev/usb/lp0";
const DEFAULT_DOTS: usize = 576; 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; const DENSITY_RANGE: std::ops::RangeInclusive<u8> = 70..=130;
/// CLAHE settings: contrast limit and tiles across the image. /// CLAHE settings: contrast limit and tiles across the image.
const CLAHE_CLIP_LIMIT: f64 = 2.0; const CLAHE_CLIP_LIMIT: f64 = 2.0;
@@ -603,7 +603,7 @@ mod tests {
let printer = Printer::from_values(None, None, None).unwrap(); let printer = Printer::from_values(None, None, None).unwrap();
assert_eq!(printer.target, Target::Device("/dev/usb/lp0".into())); assert_eq!(printer.target, Target::Device("/dev/usb/lp0".into()));
assert_eq!(printer.dots, 576); 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. // Unparsable widths fall back; valid ones are rounded to whole bytes.
let dots = |value| Printer::from_values(None, Some(value), None).unwrap().dots; let dots = |value| Printer::from_values(None, Some(value), None).unwrap().dots;
assert_eq!(dots("wide"), 576); assert_eq!(dots("wide"), 576);
@@ -611,8 +611,8 @@ mod tests {
// Gamma must be a positive number. // Gamma must be a positive number.
let gamma = |value| Printer::from_values(None, None, Some(value)).unwrap().gamma; let gamma = |value| Printer::from_values(None, None, Some(value)).unwrap().gamma;
assert_eq!(gamma(" 2.4 "), 2.4); assert_eq!(gamma(" 2.4 "), 2.4);
assert_eq!(gamma("0"), 2.0); assert_eq!(gamma("0"), 2.7);
assert_eq!(gamma("bright"), 2.0); assert_eq!(gamma("bright"), 2.7);
// An explicitly empty printer disables printing. // An explicitly empty printer disables printing.
assert!(Printer::from_values(Some(""), None, None).is_none()); assert!(Printer::from_values(Some(""), None, None).is_none());
} }