GithubHelp home page GithubHelp logo

h04x / win-screenshot Goto Github PK

View Code? Open in Web Editor NEW
33.0 1.0 3.0 63 KB

Take a screenshot of a specific window or entire screen on Windows platform

Home Page: https://crates.io/crates/win-screenshot

License: Apache License 2.0

Rust 100.00%
screen window screenshot windows display capture

win-screenshot's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

win-screenshot's Issues

Screenshot is completely broken

The screenshot taken by the example (full screen) is completly broken:

image

use image::RgbaImage;
use win_screenshot::prelude::*;

fn main() {
    let buf = capture_display().unwrap();
    let img = RgbaImage::from_raw(buf.width, buf.height, buf.pixels).unwrap();
    img.save("screenshot.jpg").unwrap();
}

Is it because I cross-compile on ubuntu linux using cargo build --target x86_64-pc-windows-gnu?

I executed the complied example on a virtual (qemu/kvm) win10 machine.

Is there a recommended way to unminimize a window?

I am really impressed with this crate regarding capturing individual windows!
Capturing works with windows that are

  • covered by other windows
  • partially outside the monitor space
  • on a different Virtual Desktop
  • or even overlapping different screens with different scaling/dpi settings

The only thing that is not quite perfect is that if the window is minimized then only a few pixels of the maximize and close button are screenshotted.

Is there a recommended way to programmatically unminimize a window before taking a screenshot?

Bad window dimension in capture_window()

I'm using win-screenshot to take screenshots of a specific window but there was a little problem with the resulting image. The dimension given to the image does not take into account the window frame and title bar. The resulting image is cropped because of this.

To fix the problem in my project I modified lines 72-73 of lib.rs:

let width = (*rc).right - (*rc).left + 16;
let height = (*rc).bottom - (*rc).top + 39;

It works perfect for my resolution (1920x1080) and windows version (Win10 21H2) but of course it is not an universal fix.

Add option to pass rect parameters to capture_window

Hi,

Thanks for making win-screenshot! It's basically the only screenshot lib I've found that allows capturing specific windows.

I am capturing a subregion of a window in a loop and found that passing my desired width and height dimensions to CreateCompatibleBitmap is much faster than capturing the whole window and then paring down the image buffer afterwards. Can a new capture_window function be added with x,y,w,h parameters?

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.