#enhance the contrast of a picture by making the #brights brighter, the darks darker. #The simple algorithm here is to take a color #component m between 0 and 255, then replace #m by 0 if m<64, replace m by 255 if m>=192, #and otherwise replace m by 2*(m-64) def increase_contrast(p): for px in getPixels(p): setRed(px,contr(getRed(px))) setBlue(px,contr(getBlue(px))) setGreen(px,contr(getGreen(px))) def contr(m): if m< 64: u=0 elif m>=192: u=255 else: u=2*(m-64) return u