Skip to content

Latest commit

 

History

History
27 lines (19 loc) · 740 Bytes

File metadata and controls

27 lines (19 loc) · 740 Bytes

Width And Height

We can use width, height and dimensions to get the size of an image.

use image::GenericImageView;

fn main() {
    let img = image::open("my_image.jpg").unwrap();

    println!("Width: {}", img.width());
    println!("Height: {}", img.height());
    println!("Dimensions: {:?}", img.dimensions());
}

Output:

Width: 1024
Height: 768
Dimensions: (1024, 768)

➡️ Next: Color Types

📘 Back: Table of contents