# [Tutor] Variations on putpixel - More Pixel manipulation - #14

D. Hartley denise.hartley at gmail.com
Wed Jun 1 19:34:30 CEST 2005

```In working out the "two different iterations at once" part, I decided
to do the following:

function that creates a "tolist" (a list of coordinate-pair-tuples,
incremented in the correct way to go around in the direction I want)

and then a for loop to iterate one by one over the wire.png (the "fromlist"):

for i in range(10000):
newim.putpixel(tolist[i],im.getpixel((i,0)))

So the first time through I should get my first "destination" pizel
from tolist, and my first "fill-in" pixel (0,0) from wire.png.  This
part seems pretty ok.

However, I think there must be a problem in my "tolist" creater
function, because the picture it gave me, while completely filled in
with pixels from wire.png, does not make anything recognizeable.  (I
am starting at the top left corner of the new image and filling in in
a spiral - to the right, down, back left, up, and so on):

def findtolist():
tolist = [(0,0)]
x = 0
y = 0
inc = 1
numtimes = 100
while numtimes > 0:
for i in range(numtimes-1):
x += inc
coord = (x,y)
tolist.append(coord)
for i in range(numtimes-1):
y += inc
coord = (x,y)
tolist.append(coord)
inc *= -1
numtimes -= 1
del tolist[10000:]