[Tutor] Python Image library
hunter92383 at gmail.com
Thu Jul 19 00:56:26 CEST 2007
On 7/19/07, Luke Paireepinart <rabidpoobear at gmail.com> wrote:
> Tiger12506 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
> > 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
> if you start counting at the 0th row and 0th column, this will give you
> the 4th row and 2nd column.
> if you're counting from the 1st row and 1st column, this will give you
> the 5th row and 3rd column.
> > That number is the index to use to get the pixel at coords (2,5)
> So this is actually (3,5) or, to count from 0, (2,4).
> But yeah, the general idea is there.
> If my math is wrong I'm sure you won't hesitate to correct me ;)
> Tutor maillist - Tutor at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor