#screenshot #screen #capture

bin+lib captis

A Screen capturing library built for Linux, Windows and MacOS

15 releases (5 breaking)

Uses new Rust 2021

new 0.6.1 Aug 13, 2022
0.6.0 Jul 27, 2022
0.5.1 Jul 25, 2022
0.4.2 Jul 22, 2022
0.1.0 May 30, 2022

#105 in Images

Download history 53/week @ 2022-05-30 32/week @ 2022-06-06 10/week @ 2022-06-13 10/week @ 2022-06-20 28/week @ 2022-06-27 113/week @ 2022-07-04 23/week @ 2022-07-11 65/week @ 2022-07-18 126/week @ 2022-07-25 21/week @ 2022-08-01 29/week @ 2022-08-08

242 downloads per month

MIT license

26KB
665 lines

Captis - A library for capturing the screen on Linux, MacOS and Windows

It's a fairly simple library that performs good enough, the OS level APIs that were used are inspired by python-mss.

Specification

  • Windows implementation uses the Windows GDI API.
  • Linux X11 implementation uses the RandR extension to get information about the displays, for capturing the XShm extension is used if available, otherwise we fallback to the standard protocol.
  • MacOS implementation uses the Core Graphics Framework.

Usage

To run this code you also need to add image crate to your project and enable the jpeg feature, otherwise you won't be able to save the file as JPEG.

The same goes for any other format as well, if you wanna treat the image as PNG you must enable png feature. Check their documentation to see which formats are available.

use captis::init_capturer;

let capturer = init_capturer().expect("Couldn't Initialize Capturer");

let image = capturer.capture(0).expect("Couldn't Capture Screen");

image.save("test.jpeg").expect("Couldn't Save Image");

Supported Platforms

  • Windows
  • Linux (X11)
  • MacOS

If any help needed feel free to contact rust@crnw.uk

Dependencies

~1.6–3MB
~62K SLoC