Ask Your Question

Revision history [back]

Yeah, numpy can handle most of that kind of thing. In general with python you want to avoid loops over large datasets wherever possible. In this case the numpy.where function is probably what you want. A very sloppy, inefficient recipie:

mycolor = (224.0, 131.0, 106.0)
coordinates = np.where(Image("lenna").colorDistance(mycolor).getNumpy()[:,:,0]
== 0)
myleftmostpixel = (coordinates[0][0], coordinates[1][0])