Screenshots-CS is a C#-Wrapper around Screenshots which is a cross-platform screenshots library for MacOS, Windows, Linux (X11, Wayland) written in Rust. It provides a simple API for capturing screenshots of a screen or a specific area of a screen.
The following example shows how to capture screenshots of all screens and a specific area of a screen.
// Soon here
The Screen
struct represents a screen capturer and provides the following methods:
Screen::new(display_info)
: Get a screen from the display info, returns aScreen
.Screen::all()
: Get all screens, returnsResult<Vec<Screen>>
.Screen::from_point(x, y)
: Get a screen from a point, returnsResult<Screen>
.screen.capture()
: Capture a screenshot of the screen, returns a image asResult<RgbaImage>
.screen.capture_area(x, y, width, height)
: Capture a screenshot of the designated area of the screen, returns the same ascapture()
.
On Linux, you need to install libxcb
, libxrandr
, and dbus
.
Debian/Ubuntu:
apt-get install libxcb1 libxrandr2 libdbus-1-3
Alpine:
apk add libxcb libxrandr dbus
This project is licensed under the Apache License. See the LICENSE file for details.