Image resizing in Rust Are there Rust features I could apply to optimize for simple test of a JPEG or PNG resized from 2000 x 2000 pixels to 150 x 150 pixels?

extern crate image;
use std::env;

fn main() {
    let mut args = env::args();
    args.next();
    let file_location = args.next().unwrap();
    let width = args.next().unwrap().parse().unwrap();
    let height = args.next().unwrap().parse().unwrap();

    let img = image::open(file_location.as_str()).unwrap();

    // img.resize(width, height, image::imageops::Lanczos3);
    img.thumbnail(width, height);
}
I would slightly change this code:

use std::error::Error;

fn main() -&gt; Result&lt;(), Box&lt;dyn Error&gt;&gt; {
    // Args arrangement
    let mut args = std::env::args().skip(1);
    assert_eq!(args.len(), 3, "Arguments must be: file_location width height");

    // Reading args
    let file_location = args.next().unwrap();
    let width = args.next().unwrap().parse()?;
    let height = args.next().unwrap().parse()?;

    // Do the job
    let img = image::open(&amp;file_location)?;
    img.thumbnail(width, height);

    // All was ok
    Ok(())
}



You can take advantage of the try operator ? to make the error handling easier.
Similarly, you can add a bit of error handling with the assert_eq line. You can use the len method because this iterator knows exactly how much elements it has.
You can use skip to discard the first element of the Args iterator.