[Tutor] Python Image library
elis aeris
hunter92383 at gmail.com
Thu Jul 19 00:41:44 CEST 2007
ahh~
it goes horizontally first
why didn't I think of that?
thank you ~
On 7/19/07, Tiger12506 <keridee at jayco.net> wrote:
>
> You know the height and the width of the image, no?
>
> So you know that every 'width' number of pixels will start a new row.
> So if you wanted say the fifth row down, second pixel, how would you find
> it?
>
> The 1st line: 'width' number of pixels
> The 2nd line: 'width' number of pixels
> The 3rd line: 'width number of pixels
> The 4th line: 'width' number of pixels
> The 5th line: 2 pixels in from the left
>
> Add those up ~ width+width+width+width+2
> Or 4*width+2
>
> That number is the index to use to get the pixel at coords (2,5)
> so
>
> pixel = getdata()
> pixel[4*width+2]
>
> For this example.
> Work out a more general solution for yourself please.
>
> JS
>
> > getdata() returns a flattened list, [n]
> >
> >
> > but i am not sure how to access it.
> >
> > when I want to get rgb from a window of 100,200,
> >
> > get data starts from 0 (0~99, 0~199)
> >
> > the point of x,y = 2, 1
> >
> > do I put in
> >
> > pixel[100] ?
> >
> >
> > it's actually not the case @_@
> >
> > what should I put in ?
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070719/8876a5d1/attachment.html
More information about the Tutor
mailing list