fixed bug with color layering issue
This commit is contained in:
@@ -11,6 +11,6 @@ categories = ["graphics", "command-line-utilities"]
|
||||
readme = "README.md"
|
||||
|
||||
[dependencies]
|
||||
rustitch = { version = "0.1.1", path = "../rustitch" }
|
||||
rustitch = { version = "0.2", path = "../rustitch" }
|
||||
clap = { version = "4", features = ["derive"] }
|
||||
anyhow = "1"
|
||||
|
||||
@@ -3,9 +3,12 @@ use clap::Parser;
|
||||
use std::fs;
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(name = "stitch-peek", about = "PES embroidery file thumbnailer")]
|
||||
#[command(
|
||||
name = "stitch-peek",
|
||||
about = "Embroidery file thumbnailer (PES, DST, EXP, JEF, VP3)"
|
||||
)]
|
||||
struct Args {
|
||||
/// Input PES file path
|
||||
/// Input embroidery file path
|
||||
#[arg(short = 'i', long = "input")]
|
||||
input: std::path::PathBuf,
|
||||
|
||||
@@ -21,11 +24,14 @@ struct Args {
|
||||
fn main() -> Result<()> {
|
||||
let args = Args::parse();
|
||||
|
||||
let format = rustitch::format::detect_from_extension(&args.input)
|
||||
.with_context(|| format!("unsupported file extension: {}", args.input.display()))?;
|
||||
|
||||
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")?;
|
||||
let png = rustitch::thumbnail_format(&data, args.size, format)
|
||||
.with_context(|| "failed to generate thumbnail")?;
|
||||
|
||||
fs::write(&args.output, &png)
|
||||
.with_context(|| format!("failed to write {}", args.output.display()))?;
|
||||
|
||||
Reference in New Issue
Block a user