For scaling down an image more quickly, we can use thumbnail. The method thumbnail works in a way similar to resize, yet it runs faster.
fn main() {
let img = image::open("my_image.jpg").unwrap();
let img2 = img.thumbnail(100, 100);
img2.save("thumbnail.jpg").unwrap();
}Original image:
thumbnail.jpg:
There is also a method thumbnail_exact, which is the corresponding method of resize_exact.
➡️ Next: Gray Scale
📘 Back: Table of contents
