Write a function to create a lightened grayscale image. First, lighten the image by adding 75 to the red, green, and blue components of every pixel. Since higher numbers are closer to white, this should make the pixel lighter. Now, grayscale the new image.
What will be an ideal response?
```
def grayscale2(picture):
for p in getPixels(picture):
valueR = getRed(p)+75
valueG = getGreen(p)+75
valueB = getBlue(p)+75
setColor(p,makeColor(valueR ,valueG ,valueB))
for p in getPixels(picture):
intensity = (getRed(p)+getGreen(p)+getBlue(p))/3
setColor(p,makeColor(intensity ,intensity ,intensity))
OR (more simply)
def grayscale2(picture):
for p in getPixels(picture):
valueR = getRed(p)+75
valueG = getGreen(p)+75
valueB = getBlue(p)+75
intensity = (valueR+valueG+valueB)/3
setColor(p,makeColor(intensity ,intensity ,intensity))
```
You might also like to view...
Adding a ____ to text adds depth and helps the letters display prominently.
A. sizing handle B. shadow C. font D. shape
The most commonly used type of relationship is the one-to-one relationship
Indicate whether the statement is true or false
You can press Esc to turn off Format Painter
Indicate whether the statement is true or false
A counter causes a process to be repeated until a condition or marker is encountered.
Answer the following statement true (T) or false (F)