Add Rust logo pipeline: trim, metrics, knockout and Branding settings

Logos (PNG, JPEG, WebP) are decoded, trimmed to their ink box, downscaled
to 1200 px and re-encoded as a content-addressed print PNG plus a white
knockout variant when the logo has alpha; aspect, ink density, mean colour
and kind (wordmark, mark, tall) are stored with the settings and frozen in
the issue snapshot. Legacy logos are derived at startup. The Arun P logo
PDF shrinks from 334 KB to 92 KB. Settings gains a Branding section with
white and dark previews and a business-name toggle (migration M5).
This commit is contained in:
2026-10-04 06:31:30 +05:30
parent afd07071c3
commit 74ba04e17f
27 changed files with 1615 additions and 37 deletions
+9
View File
@@ -1,6 +1,7 @@
mod commands;
mod db;
mod gst;
mod logo;
mod models;
mod selftest;
@@ -66,6 +67,10 @@ fn init_state(app: &tauri::App) -> Result<AppState, Box<dyn std::error::Error>>
show_startup_error(app, &format!("Could not update stored image paths: {e}"), Some(&data_dir));
return Err(e.into());
}
// Best effort: a logo that cannot be derived keeps working untrimmed, and the next start retries.
if let Err(e) = commands::logo::ensure_logo_derived_impl(&conn, &data_dir) {
eprintln!("Could not derive the logo images: {e}");
}
Ok(AppState {
db: Mutex::new(conn),
data_dir,
@@ -129,6 +134,10 @@ pub fn run() {
commands::assets::save_asset_bytes,
commands::assets::read_asset_data_uri,
commands::assets::remove_asset,
commands::logo::import_logo,
commands::logo::save_logo_bytes,
commands::logo::ensure_logo_derived,
commands::logo::remove_logo,
commands::archive::archive_pdf,
commands::archive::read_archive,
commands::archive::archive_status,