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 image =
|
||||
ImageReader::open(file_path).context(format!("Failed to open image at {}", args[1]))?;
|
||||
let image = ImageReader::open(file_path)
|
||||
.context(format!("Failed to open image at {}", file_path.display()))?;
|
||||
|
||||
app.file_name = file_path.file_name().unwrap().to_str().unwrap().to_string();
|
||||
|
||||
match image.format().unwrap() {
|
||||
ImageFormat::Gif => {
|
||||
let mut animation = Animation::default();
|
||||
let file = BufReader::new(
|
||||
File::open(args[1].clone())
|
||||
.context(format!("Failed to open GIF file at {}", args[1]))?,
|
||||
);
|
||||
let file = BufReader::new(File::open(file_path).context(format!(
|
||||
"Failed to open GIF file at {}",
|
||||
file_path.display()
|
||||
))?);
|
||||
let decoder = GifDecoder::new(file).context("Failed to create GIF decoder")?;
|
||||
let frames = decoder
|
||||
.into_frames()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue