I am trying to pull the overall pixel count of the R, G, B, Black, & White values in a premade picture. This picture has 100 Red, 100 Green, 100 Blue, 100 Black, and 100 white.
I have started with my code, but for some reason it seems as if my code is only counting 1 pixel.. Jython has predefined 16 colors, so I am using the red, blue, green datatypes.
Here is what I have so far:
def main():
file = pickAFile( )
pic = makePicture( file )
pxRed = 0
pxGreen = 0
pxBlue = 0
numR = 0
numG = 0
numB = 0
printNow("Now let's count some pixels...")
for px in getPixels( pic ):
r = getRed(px)
g = getGreen(px)
b = getBlue(px)
If px is (255,0,0): #error here
numR += 1
printNow("You have " + numR + " red pixels")
show(pic)
unsure why this is not working..