Wednesday, June 20, 2007

Grab screen capture programatically

Pre-requisite:
  1. Python 2.5 for Windows
  2. Python Imaging Library (PIL).

Install Python 2.5 for Microsoft Windows. Make sure that you have administrative rights to be able to install the application properly. After having verified that Python is installed and working, install Python Imaging Library. See below for a sample of screen capture python script.

#--<-start code here->--

import ImageGrab;

img = ImageGrab.grab
()
img.save(
"D:\\test.jpg")

 

#--<-end code here->--
~ts~

No comments: