Skip to content

Latest commit

 

History

History
27 lines (17 loc) · 1023 Bytes

File metadata and controls

27 lines (17 loc) · 1023 Bytes

Resizing To Thumbnail

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:

my_image

thumbnail.jpg:

thumbnail

There is also a method thumbnail_exact, which is the corresponding method of resize_exact.

➡️ Next: Gray Scale

📘 Back: Table of contents