nashaofu / xcap

XCap is a cross-platform screen capture library written in Rust. It supports Linux (X11, Wayland), MacOS, and Windows. XCap supports screenshot and video recording (to be implemented).
https://docs.rs/xcap
Apache License 2.0
491 stars 58 forks source link

Cannot capture image in second screen #79

Closed ctkai01 closed 1 year ago

ctkai01 commented 1 year ago

I run this code and being panic in Ubuntu 20.04 Wayland: called Result::unwrap() on an Err value: IoError(Custom { kind: Other, error: "Zero width not allowed" }). Here is my code: ` use screenshots::Screen; fn main() { let screens = Screen::all().unwrap();

for screen in screens {
    println!("Capturing {screen:?}");
    let image = screen.capture_area(screen.display_info.x, screen.display_info.y, screen.display_info.width, screen.display_info.height).unwrap();
    image.save(format!("images/{}.png", screen.display_info.id)).unwrap();
}

}`

nashaofu commented 1 year ago

fixed #81