Try the program above on some of the other images, like “arch.jpg” or “puppy.jpg”, by changing the name of the image file on line 5. What effect does it always have? Is this what you expected when we decrease the red?
Try the program above on some of the other images by changing the name of the image file on line 5. What effect does it always have? Is this what you expected when you increase the red? What happens if you increase two colors at the same time?
Another way to get a similar effect to increasing the red, is to decrease the green and blue. Figure out how to do that in the program above and then use that information to drag the code blocks below from the left to the right in the correct order with the correct indention.
# STEP 1: USE THE IMAGE LIBRARY
from image import *
# STEP 2: PICK THE IMAGE
img = Image("puppy.jpg")
# STEP 3: LOOP THROUGH THE PIXELS
pixels = img.getPixels()
for p in pixels:
# STEP 4: GET THE DATA
r = p.getRed()
g = p.getGreen()
b = p.getBlue()
# STEP 5: MODIFY THE COLOR
p.setRed(r * .5)
p.setGreen(g * 1.5)
p.setBlue(b * 1.5)
# STEP 6: UPDATE THE IMAGE
img.updatePixel(p)
# STEP 7: SHOW THE RESULT
win = ImageWin(img.getWidth(),img.getHeight())
img.draw(win)