Tag: 截图

在C中不成功使用popen()?

我可以运行以下命令 xwd -root | xwdtopnm | pnmtojpeg > screen.jpg 在Linux下的终端,它将生成我当前屏幕的截图。 我尝试使用以下代码执行以下操作: #include #include int main() { FILE *fpipe; char *command=”xwd -root | xwdtopnm | pnmtojpeg”; char line[256]; if ( !(fpipe = (FILE*)popen(command,”r”)) ) { // If fpipe is NULL perror(“Problems with pipe”); exit(1); } while ( fgets( line, sizeof line, fpipe)) { //printf(“%s”, line); puts(line); […]

截面颜色平均矩形

我写了一个快速的python脚本来返回屏幕周边的矩形的平均颜色。 (这里的最终目标是在我的显示器周围放置RGB LED条 ,以便在电影期间获得发光效果 – 像这样(youtube) ,但更有趣,因为我自己制作它)。 我目前正在使用autopy将屏幕作为位图(“屏幕截图”),获取每个像素值以及RGB HEX转换。 简化版: step = 1 width = 5 height = 5 b = autopy.bitmap.capture_screen() for block in border_block(width, height): # for each rectangle around the perimeter of my screen R,G,B = 0,0,0 count = 0 for x in xrange(block.x_min, block.x_max, step): for y in xrange(block.y_min, block.y_max, step): […]

C或C ++和Linux中的屏幕截图程序

我正在寻找一个使用C或Cpp在Linux中捕获屏幕的程序。 有人可以帮助给出一个可以帮助我的骨架结构或程序。 感谢致敬。

用libx11截取屏幕截图

我目前正在尝试使用libx11截取屏幕截图 #include #include #include int main(void) { XImage* pic; Display* dpl; unsigned int buffer_size; dpl = XOpenDisplay(“127.0.0.1:0.0”); pic = XGetImage(dpl, RootWindow(dpl, DefaultScreen(dpl)), 10, 10, 201, 201, AllPlanes, ZPixmap); } 如果我使用-lX11编译代码并运行它,我会不断收到分段错误。 有任何想法吗? 提前致谢!

用C \ GTK截取屏幕截图

我正试图用C和GTK拍摄整个屏幕的截图。 出于速度原因,我不想打电话给外部应用程序。 我已经为此找到了Python代码( 通过python脚本截取屏幕截图。[Linux] ); 我只需要弄清楚如何在C中做到这一点。