[Tutor] Fwd: More image manipulation

D. Hartley denise.hartley at gmail.com
Tue Jun 7 23:57:33 CEST 2005


Sorry, Terry, forgot to reply to the whole list. Here it is:

---------- Forwarded message ----------
From: D. Hartley <denise.hartley at gmail.com>
Date: Jun 7, 2005 2:49 PM
Subject: Re: [Tutor] More image manipulation
To: Terry Carroll <carroll at tjc.com>


Terry,

OK. I tried them out and I do see the diffence. (btw, testit1 gave me
the following error:

Traceback (most recent call last):
 File "<pyshell#72>", line 1, in ?
   testit1()
 File "<pyshell#68>", line 3, in testit1
   del fromlist[0]
IndexError: list assignment index out of range

... was that something you intended? that didnt happen with my
original problem).

Anyway I def notice the diff between 2 and 3, but see here's the thing:

I think I *do* want it like #2, becaues I want it to keep returning
the same list (i.e., move on and use line 2 (b), and then line 3 (c),
and so on), rather than keep iterating over the same first line (a)
over and over again. I want to take the first line in the picture,
rearrange the pixels, and pop that line into the new list that I can
then (eventually) create a new image from. I *thought* my list was
populated (it's 307200 pixels long, after all), but it wont work when
i try to putdata it onto a new blank image.



> > where does the variable named "fromlist" come from?  It's not passed into
> > the method as a parameter.

No, I had it defined right before the function. it pulls it in just
fine. And like I said, the function returns me with a list of 307200
values - which makes me think that it "got" all 307200 of the original
pixels, and performed the function correctly on each line. However,
when I did the following:

def test():
   y = findlist()
   for i in range(480):
       piece = y[:640]
       del y[:640]
       print "Line",i," - ",y[:5]

to look at the beginning five pixels of each of the new lines, for
line 479 (the last i), it gave me []. This doesnt make sense!

Hope I didnt miss something from your explanation...?

~Denise


More information about the Tutor mailing list