Taking Screenshots in rust

What is the best way to take a screenshot and save it to a .png or .jpeg file? I tried using the crate screenshot, but my code wouldn't compile and had the error:

error[E0635]: unknown feature `convert`
  --> /Users/xxxxxxxxx/.cargo/registry/src/github.com-1ecc6299db9ec823/screenshot-0.0.7/src        /lib.rs:15:29
   |
15 | #![feature(core_intrinsics, convert)]
   |                             ^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0635`.
error: could not compile `screenshot`.

I also tried using the crate screenshot-rs, but screenshot-rs is not compatible with macos.
How do you suggest I should take screenshots in rust?

Try scrap instead.

1 Like