2

I'm building an app that needs to be able to take intermittent screen captures of a target window while running in the background. That is, it needs to be able to screenshot a specific window without user interaction.

Say for example I have Photoshop open, I'd like to capture a screenshot of my open Photoshop document every few minutes and save the capture to a file, essentially building a visual history of how the document has changed over time.

Currently I'm searching for a Unix/Mac solution but Window's suggestions are warmly welcomed.

Screencapture & Scrot both require mouse interaction to target a window & from what I've researched Imagemagick requires xwd to launch to get the id of the target window.

I'm looking for a lightweight solution (that I can bundle with my software) or ideally a solution already built into the OS to accomplish this.

Any suggestions would be very much appreciated. Cheers.

braitsch
  • 14,906
  • 5
  • 42
  • 37
  • 1
    you may have a few options here http://stackoverflow.com/questions/69645/take-a-screenshot-via-a-python-script-linux and here http://stackoverflow.com/questions/1774222/taking-screenshot-of-a-specific-window-c-qt – Pierre Lacave Sep 08 '11 at 16:38

2 Answers2

0

xwd utility can dump particular X11 window content. It accepts window ID to dump as an argument and can be used in non-interactive mode.

ArtemB
  • 3,496
  • 17
  • 18
0

To capture the whole X-desktop on any unix/linux non-interactively you can call:

xwd -root > file

To display the dump:

xwud -in file
pitseeker
  • 2,535
  • 1
  • 27
  • 33