def checkLum(red, green, blue): luminance = 0.299*red + 0.587*green + 0.114*blue if (luminance < 10): print ("That's going to be awfully dark.") elif ((luminance > 50) and (luminance < 200)): print ("Looks like a good range.") elif (luminance >= 250): print ("Thats's going to be nearly white!") def removeRedEye(pic, startX, startY, endX, endY, replacementColor,threshold): red = makeColor(255,0,0) for x in range(startX,endX+1): for y in range(startY, endY+1): currentPixel = getPixel(pic,x,y) currentColor = getColor(currentPixel) currentRed = getRed(currentPixel) print currentRed if (currentRed > 90): if (distance(red,currentColor) < threshold): setColor(currentPixel, replacementColor) def removeRedEyeForBoxes(pic, boxes, replacementColor, threshold): for box in boxes: startX = box[0] startY = box[1] endX = box[2] endY = box[3] removeRedEye(pic, startX, startY, endX, endY, replacementColor, threshold)