dcx_screencapturer

Crates.iodcx_screencapturer
lib.rsdcx_screencapturer
version0.1.4
sourcesrc
created_at2023-07-27 14:40:33.452867
updated_at2023-08-05 18:03:00.311798
descriptionA library to capture screens
homepage
repositoryhttps://github.com/diocarvalho/dcx-screencapturer-rs
max_upload_size
id927485
size5,554
(diocarvalho)

documentation

https://github.com/diocarvalho/dcx-screencapturer-rs

README

dcx_screencapturer

This library was made to capture screens, from the operating systems:

Windows - work;

Linux - coming soon;

MacOs - coming soon;

Example code:

extern crate image;
extern crate dcx_screencapturer;

//used to receive buffer and save to selected format
use image::{ImageBuffer, Rgb, ImageFormat};
use dcx_screencapturer::capture_screen;

fn main() {
    //Gets the ImageBuffer<Rgb<u8>, Vec<u8>> using this parameters
    //width, height, monitor_index
    let buffer = capture_screen( 1920, 1080, 0);
    let image_buffer = ImageBuffer::<Rgb<u8>, _>::from_raw(1920, 1080, buffer)
    .expect("Error converting to ImageBuffer");
    //path to save image file
    let image_path = "capture.png";
    //saving with png format
    image_buffer.save_with_format(image_path, ImageFormat::Png)
    .expect("Error saving image");
    print!("Image salved in path : {image_path}")
}

Just add the libraries on Cargo.toml

[dependencies]
image = "0.24.6"
dcx_screencapture = "0.1.3"
Commit count: 15

cargo fmt