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