"Paul McGuire" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Chaos" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > > > > myCol = (0.3 * image.GetRed(thisX, thisY)) + (0.59 * > > image.GetGreen(thisX, thisY)) + (0.11 * image.GetBlue(thisX, thisY)) > > if myCol < darkestCol: > > darkestCol = myCol > > possX = thisX > > possY = thisY > > > > Psyco may be of some help to you, especially if you extract out your myCol > expression into its own function, something like: > > def darkness(img,x,y): > return (0.3 * img.GetRed(x,y)) + (0.59 * img.GetGreen(x,y)) + (0.11 * > img.GetBlue(x,y)) > <snip>
Even better than my other suggestions might be to write this function, and then wrap it in a memoizing decorator (http://wiki.python.org/moin/PythonDecoratorLibrary#head-11870a08b0fa59a8622 201abfac735ea47ffade5) - surely there must be some repeated colors in your image. -- Paul -- http://mail.python.org/mailman/listinfo/python-list