Add auto configuration option for example
This commit is contained in:
parent
6e85a82f42
commit
66858e4d1a
|
@ -13,8 +13,8 @@ struct Args {
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
height: u32,
|
height: u32,
|
||||||
|
|
||||||
#[clap(long, default_value = "8")]
|
#[clap(long)]
|
||||||
skip: u32,
|
skip: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Example usage:
|
// Example usage:
|
||||||
|
@ -28,11 +28,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
height,
|
height,
|
||||||
skip,
|
skip,
|
||||||
} = Args::parse();
|
} = Args::parse();
|
||||||
let mut encoder = Encoder::new(
|
|
||||||
Components { x: 4, y: 3 },
|
let mut encoder = if let Some(skip) = skip {
|
||||||
ImageBounds { width, height },
|
Encoder::new(
|
||||||
skip,
|
Components { x: 4, y: 3 },
|
||||||
)?;
|
ImageBounds { width, height },
|
||||||
|
skip,
|
||||||
|
)?
|
||||||
|
} else {
|
||||||
|
Encoder::auto(ImageBounds { width, height })
|
||||||
|
};
|
||||||
|
|
||||||
let mut stdin = std::io::stdin().lock();
|
let mut stdin = std::io::stdin().lock();
|
||||||
let mut buf = [0u8; 1024];
|
let mut buf = [0u8; 1024];
|
||||||
|
|
Loading…
Reference in a new issue