哪种截图有效?

问题描述 投票:-1回答:1

目前,我正在截取整个屏幕的截图,但我只在整个屏幕的1/4中查找一些像素块。

所以,我想知道哪个更快的方式来截取屏幕截图,可能是整个屏幕还是屏幕区域?哪些使用较少的内存或CPU使用?

c# screenshot
1个回答
0
投票

你看过this的问题吗?

建议的CopyFromScreen()方法允许您从屏幕复制像素的任何部分,例如像这样:

// The x and y position of the portion on the screen that should be captured.
int x = 0, y = 0;
// The width and height of the screenshot.
int width = 200;
int height = 200;
var screenBmp = new Bitmap(width, height);
var g = Graphics.FromImage(screenBmp);
// Copy pixels from the screen.
g.CopyFromScreen(x, y, 0, 0, screenBmp.Size);
screenBmp.Save("screenshot.png", System.Drawing.Imaging.ImageFormat.Png);
© www.soinside.com 2019 - 2024. All rights reserved.