h04x / win-screenshot Goto Github PK
View Code? Open in Web Editor NEWTake 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
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
The screenshot taken by the example (full screen) is completly broken:
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.
I am really impressed with this crate regarding capturing individual windows!
Capturing works with windows that are
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?
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.