From one of my scripts:
Instead of testing >0 you may want to try >127.
In my Point class, pixelX and pixelY are pseudo attributes:
Code:
def isSelectedPoint(point,image):
x,y=point.pixelX,point.pixelY
return 0<=x<image.width and 0<=y<image.height and image.selection.get_pixel(x,y)[0] > 0
Instead of testing >0 you may want to try >127.
In my Point class, pixelX and pixelY are pseudo attributes:
Code:
@property
def pixelX(self):
return int(math.floor(self.x))
@property
def pixelY(self):
return int(math.floor(self.y))