[Tutor] Python Image library
hunter92383 at gmail.com
Thu Jul 19 00:41:44 CEST 2007
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
> 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)
> pixel = getdata()
> For this example.
> Work out a more general solution for yourself please.
> > 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 ?
> > it's actually not the case @_@
> > what should I put in ?
> Tutor maillist - Tutor at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor