I found out that by making a copy of it, it can be load() ed !
it runs 3 times faster now import time import ImageGrab 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)) start_time = time.time() num_pixels = 0 num_black = 0 pix = image.copy().load() print time.time() for x in xrange(200): for y in xrange(200): num_pixels += 1 if pix[x, y] == (0, 0, 0): num_black += 1
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor