0

I am using Python Image Library to get a sort of brightness value for each pixel, based on its Euclidean Distance measured from white.
From what I can discern from PIL's documentation, Image.point() manipulates each pixel according to a color table. But what I need is a way to reach each pixel's value in a way similar to this: pixel.r pixel.g pixel.b in order to use them to fit the calculation to the distance formula.

I'm new to PIL, and its documentation is a bit fuzzy. Is Image.point() up to a task like this? If not, where else might I look?

purrduc
  • 135
  • 1
  • 5
  • You may want to check bands - I assume RGB - then getdata(). That give you a list (iterator to) and data[x] = (r, g, b).From here you can get eache level, and much faster than getpixel. Only be careful to convert coordinates in plain numbers - width/height - since this list is a linear indexed object from 0 to width x height - 1 – cox Jan 25 '14 at 11:31
  • Works nicely, thank you. – purrduc Feb 02 '14 at 17:36

0 Answers0