slartibartfast
slartibartfast

Reputation: 4428

Screenshots in X11

What functions would one use to take a screenshot of an X11 desktop, using the Xlib library? I would prefer a method that's more efficient than getting individual pixels. Thanks.

Upvotes: 3

Views: 3451

Answers (1)

user597630
user597630

Reputation: 571

The standard tool for taking screenshots in X11 is to use

xwd -root > myscreen.xwd

Then, convert to .pnm with

xwd2pnm myscreen.xwd > myscreen.pnm

Therefore, you can locate the source code of xwd and see how it is implemented, http://cvsweb.xfree86.org/cvsweb/xc/programs/xwd/xwd.c?rev=HEAD&content-type=text/vnd.viewcvs-markup

Upvotes: 7

Related Questions