How do I make this code print the total number of bright pixels that are over 200:
from PIL import Image
img = input("File name: ")
img = Image.open(img);
for y in range(img.height):
for x in range(img.width):
pixel = img.getpixel((x, y))
if pixel >= 200:
print(pixel,"pixels are bright.")
Right now it's printing every single pixel that is over 200 on new lines, but I just want one line that prints the total like this:
File name: slippers.png
121081 pixels are bright.