init
Some checks failed
Release / build-deb (push) Has been cancelled
CI / check (pull_request) Has been cancelled
CI / version-check (pull_request) Has been cancelled

This commit is contained in:
2026-03-30 00:01:49 +02:00
commit da71b56f2d
18 changed files with 1406 additions and 0 deletions

9
stitch-peek/Cargo.toml Normal file
View File

@@ -0,0 +1,9 @@
[package]
name = "stitch-peek"
version = "0.1.0"
edition = "2021"
[dependencies]
rustitch = { path = "../rustitch" }
clap = { version = "4", features = ["derive"] }
anyhow = "1"

34
stitch-peek/src/main.rs Normal file
View File

@@ -0,0 +1,34 @@
use anyhow::{Context, Result};
use clap::Parser;
use std::fs;
#[derive(Parser)]
#[command(name = "stitch-peek", about = "PES embroidery file thumbnailer")]
struct Args {
/// Input PES file path
#[arg(short = 'i', long = "input")]
input: std::path::PathBuf,
/// Output PNG file path
#[arg(short = 'o', long = "output")]
output: std::path::PathBuf,
/// Thumbnail size in pixels
#[arg(short = 's', long = "size", default_value = "128")]
size: u32,
}
fn main() -> Result<()> {
let args = Args::parse();
let data = fs::read(&args.input)
.with_context(|| format!("failed to read {}", args.input.display()))?;
let png = rustitch::thumbnail(&data, args.size)
.with_context(|| "failed to generate thumbnail")?;
fs::write(&args.output, &png)
.with_context(|| format!("failed to write {}", args.output.display()))?;
Ok(())
}