简体   繁体   中英

Screen capture without user interaction

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM