[Tutor] im.getdata()

elis aeris hunter92383 at gmail.com
Sun Jul 1 21:26:15 CEST 2007


I am capturing a screen shot, but then the image was already


image,   how do I .load it ?

it's not image.load()




import time
import ImageGrab  # Part of PIL
from ctypes import *

class RECT(Structure):
  _fields_ = [
    ('left', c_ulong),
    ('top', c_ulong),
    ('right', c_ulong),
    ('bottom', c_ulong)
    ]


GetForegroundWindow = windll.user32.GetForegroundWindow
GetWindowRect = windll.user32.GetWindowRect


rect = RECT()
foreground_window = GetForegroundWindow()
GetWindowRect(foreground_window, byref(rect))
image = ImageGrab.grab((rect.left, rect.top, rect.right, rect.bottom))



print time.time()

pix = image.load()
print pix[x, y]

x = 0
y = 0
for x in xrange(1,1024,1):
  for y in xrange(1,768,1):
    print pix[10,10]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070701/87bb1998/attachment.htm 


More information about the Tutor mailing list