Re: Fastest Way To Loop Through Every Pixel

2006-08-05 Thread Chaos
Fredrik Lundh wrote: > Chaos wrote: > > > I have tried PIL. Not only that, but the Image.eval function had no > > success either. I did some tests and I found out that Image.eval only > > called the function a certain number of times either 250, or 255. > > Unless I can find a working example for

Re: Fastest Way To Loop Through Every Pixel

2006-07-31 Thread Fredrik Lundh
Chaos wrote: > I have tried PIL. Not only that, but the Image.eval function had no > success either. I did some tests and I found out that Image.eval only > called the function a certain number of times either 250, or 255. > Unless I can find a working example for this function, its impossible > t

Re: Fastest Way To Loop Through Every Pixel

2006-07-31 Thread nikie
Paul McGuire wrote: > "Chaos" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > > Paul McGuire wrote: > > > "Paul McGuire" <[EMAIL PROTECTED]> wrote in message > > > news:[EMAIL PROTECTED] > > > > "Chaos" <[EMAIL PROTECTED]> wrote in message > > > > news:[EMAIL PROTECTED] > > > >

Re: Fastest Way To Loop Through Every Pixel

2006-07-31 Thread Paul McGuire
"Chaos" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Paul McGuire wrote: > > "Paul McGuire" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > "Chaos" <[EMAIL PROTECTED]> wrote in message > > > news:[EMAIL PROTECTED] > > > > > > > > > > > > myCol = (0.3 * image

Re: Fastest Way To Loop Through Every Pixel

2006-07-31 Thread nikie
Chaos wrote: > nikie wrote: > > 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 > > > >

Re: Fastest Way To Loop Through Every Pixel

2006-07-30 Thread Chaos
Paul McGuire wrote: > "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.

Re: Fastest Way To Loop Through Every Pixel

2006-07-29 Thread Paul McGuire
"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 <

Re: Fastest Way To Loop Through Every Pixel

2006-07-29 Thread Ron Adam
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

Re: Fastest Way To Loop Through Every Pixel

2006-07-29 Thread Chaos
nikie wrote: > 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 millis

Re: Fastest Way To Loop Through Every Pixel

2006-07-29 Thread Chaos
nikie wrote: > 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 millis

Re: Fastest Way To Loop Through Every Pixel

2006-07-28 Thread nikie
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 t

Re: Fastest Way To Loop Through Every Pixel

2006-07-28 Thread John Machin
Terry Reedy wrote: > "Chaos" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >> > 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): > >> >

Re: Fastest Way To Loop Through Every Pixel

2006-07-28 Thread Terry Reedy
"Chaos" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> > 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

Re: Fastest Way To Loop Through Every Pixel

2006-07-28 Thread jay graves
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 th

Re: Fastest Way To Loop Through Every Pixel

2006-07-28 Thread H J van Rooyen
"Paul McGuire" <[EMAIL PROTECTED]> wrote: | "H J van Rooyen" <[EMAIL PROTECTED]> wrote in message | news:[EMAIL PROTECTED] | > "Paul McGuire" <[EMAIL PROTECTED]> wrote: | > | > | Even downer-and-dirtier, you could approximate 30 with 32, 59 with 64, | and | > | 11 with 8, and do bit-shifting ins

Re: Fastest Way To Loop Through Every Pixel

2006-07-28 Thread c d saunter
Chaos ([EMAIL PROTECTED]) wrote: : He is the code #Actions here : 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 You really don't wa

Re: Fastest Way To Loop Through Every Pixel

2006-07-28 Thread Ben Sizer
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 th

Re: Fastest Way To Loop Through Every Pixel

2006-07-28 Thread Paul McGuire
"H J van Rooyen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Paul McGuire" <[EMAIL PROTECTED]> wrote: > > | Even downer-and-dirtier, you could approximate 30 with 32, 59 with 64, and > | 11 with 8, and do bit-shifting instead of multiplying: > | > | def darkness(img,x,y): > |

Re: Fastest Way To Loop Through Every Pixel

2006-07-28 Thread Simon Forman
Simon Forman wrote: > Chaos wrote: > > Simon Forman wrote: > > > 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): > > > > #Actio

Re: Fastest Way To Loop Through Every Pixel

2006-07-28 Thread H J van Rooyen
"Paul McGuire" <[EMAIL PROTECTED]> wrote: | Even downer-and-dirtier, you could approximate 30 with 32, 59 with 64, and | 11 with 8, and do bit-shifting instead of multiplying: | | def darkness(img,x,y): | return (RedVal(img,x,y) << 5) + (GreenVal(img,x,y) << 6) + | (BlueVal(img,x,y) << 3) | |

Re: Fastest Way To Loop Through Every Pixel

2006-07-28 Thread Simon Forman
Chaos wrote: > Simon Forman wrote: > > 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 > > >

Re: Fastest Way To Loop Through Every Pixel

2006-07-27 Thread Paul McGuire
"Nick Vatamaniuc" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello Chaos, > > Then of course if you do the whole thing many times you could just > pre-generate the indices as in: > all_indices=[] > for i in xrange(thisHeight): > for j in xrange(thisWidth): > all_indices.a

Re: Fastest Way To Loop Through Every Pixel

2006-07-27 Thread Paul McGuire
"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 b

Re: Fastest Way To Loop Through Every Pixel

2006-07-27 Thread Chaos
Simon Forman wrote: > 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 m

Re: Fastest Way To Loop Through Every Pixel

2006-07-27 Thread Casey Hawthorne
Have you tried PIL? (Python Imaging Library) "Chaos" <[EMAIL PROTECTED]> 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

Re: Fastest Way To Loop Through Every Pixel

2006-07-27 Thread Simon Forman
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 th

Re: Fastest Way To Loop Through Every Pixel

2006-07-27 Thread Chaos
Chaos wrote: > John Machin wrote: > > 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 > > >

Re: Fastest Way To Loop Through Every Pixel

2006-07-27 Thread Nick Vatamaniuc
Hello Chaos, Whatever you do in "#Actions here ..." might be expressed nicely as a ufunction for numeric. Then you might be able to convert the expression to a numeric expression. Check out numpy/scipy. In general, if thisHeight, thisWidth are large use xrange not range. range() generates a list

Re: Fastest Way To Loop Through Every Pixel

2006-07-27 Thread Chaos
John Machin wrote: > 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 > > OT: you don't need the 0 in

Re: Fastest Way To Loop Through Every Pixel

2006-07-27 Thread John Machin
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 OT: you don't need the 0 in the range call. Taking it out does