Fastest Way To Loop Through Every Pixel

Ben Sizer kylotan at gmail.com
Fri Jul 28 06:13:37 EDT 2006


Chaos wrote:
> As my first attempt to loop through every pixel of an image, I used
>
>         for thisY in range(0, thisHeight):
>             for thisX in range(0, thisWidth):
>                   #Actions here for Pixel thisX, thisY
>
> But it takes 450-1000 milliseconds
>
> I want speeds less than 10 milliseconds

The main question is: why do you want to do this? I ask because with
performance requirements like that, you almost certainly need another
approach, one which I may be able to suggest.

-- 
Ben Sizer




More information about the Python-list mailing list