use parsed file_path instead of passed argument
This commit is contained in:
parent
f1bde5df89
commit
7a2d159ee1
1 changed files with 6 additions and 6 deletions
12
src/main.rs
12
src/main.rs
|
|
@ -176,18 +176,18 @@ fn main() -> anyhow::Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut app = App::default();
|
let mut app = App::default();
|
||||||
let image =
|
let image = ImageReader::open(file_path)
|
||||||
ImageReader::open(file_path).context(format!("Failed to open image at {}", args[1]))?;
|
.context(format!("Failed to open image at {}", file_path.display()))?;
|
||||||
|
|
||||||
app.file_name = file_path.file_name().unwrap().to_str().unwrap().to_string();
|
app.file_name = file_path.file_name().unwrap().to_str().unwrap().to_string();
|
||||||
|
|
||||||
match image.format().unwrap() {
|
match image.format().unwrap() {
|
||||||
ImageFormat::Gif => {
|
ImageFormat::Gif => {
|
||||||
let mut animation = Animation::default();
|
let mut animation = Animation::default();
|
||||||
let file = BufReader::new(
|
let file = BufReader::new(File::open(file_path).context(format!(
|
||||||
File::open(args[1].clone())
|
"Failed to open GIF file at {}",
|
||||||
.context(format!("Failed to open GIF file at {}", args[1]))?,
|
file_path.display()
|
||||||
);
|
))?);
|
||||||
let decoder = GifDecoder::new(file).context("Failed to create GIF decoder")?;
|
let decoder = GifDecoder::new(file).context("Failed to create GIF decoder")?;
|
||||||
let frames = decoder
|
let frames = decoder
|
||||||
.into_frames()
|
.into_frames()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue