Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2008上截图是空白的 #92

Closed
lz520520 opened this issue Jan 25, 2024 · 10 comments
Closed

2008上截图是空白的 #92

lz520520 opened this issue Jan 25, 2024 · 10 comments

Comments

@lz520520
Copy link
Contributor

如下所示,
image

使用的参考代码是

use xcap::Monitor;
use std::time::Instant;

fn normalized(filename: &str) -> String {
    filename
        .replace("|", "")
        .replace("\\", "")
        .replace(":", "")
        .replace("/", "")
}

fn main() {
    let start = Instant::now();
    let monitors = Monitor::all().unwrap();

    for monitor in monitors {
        let image = monitor.capture_image().unwrap();

        image
            .save(format!("target/monitor-{}.png", normalized(monitor.name())))
            .unwrap();
    }

    println!("运行耗时: {:?}", start.elapsed());
}
@lz520520
Copy link
Contributor Author

还遇到一个问题,我多屏幕的时候,两个屏幕分辨率不同,这个低分辨率的副屏截图会多出来一块主屏的图
image

@nashaofu
Copy link
Owner

windows 2008 的server吗?这个没有支持的打算哈

@nashaofu
Copy link
Owner

还遇到一个问题,我多屏幕的时候,两个屏幕分辨率不同,这个低分辨率的副屏截图会多出来一块主屏的图 image

这个晚点看一下

@lz520520
Copy link
Contributor Author

我测试了一个golang的库,和你这个项目调用的差不多的接口,他在2008 server上是正常的。
https://github.com/kbinani/screenshot/blob/master/screenshot_windows.go

第二个问题我解决了,你可以参考下,主要是把capture_monitor函数中的monitor句柄换成当前桌面窗口句柄
https://github.com/lz520520/xcap

@lz520520
Copy link
Contributor Author

我08換了台又截了一张,感觉是RGBA颜色问题
image

@lz520520
Copy link
Contributor Author

emmm,问题解决了,应该是2008不支持A
image

@nashaofu
Copy link
Owner

还遇到一个问题,我多屏幕的时候,两个屏幕分辨率不同,这个低分辨率的副屏截图会多出来一块主屏的图 image

你的分辨率是怎么设置的,我在自己电脑上复现一下

@lz520520
Copy link
Contributor Author

主屏3840_2160,副屏1920_1080

@nashaofu
Copy link
Owner

你可以在你电脑上测试一下这个版本,#94

@lz520520
Copy link
Contributor Author

测了ok了,就是CreateDC对应DeleteDC,GetDC/GetWindowDC对应ReleaseDC,还是有区别的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants