Oct-26-2017, 05:33 AM
You still have to find the maximum yourself.
As Mekire already said: This solution is slow.
As Mekire already said: This solution is slow.
from PIL import Image img = Image.open('grey.jpg') for row in range(img.height): counter = 0 for col in range(img.width): pixel = img.getpixel((col,row)) red = pixel[0]; green = pixel[1]; blue = pixel[2] grey = (red + green + blue) // 3 if grey > 200: counter += 1 if counter != 0: print("row %d: %d" % (row, counter))