The code below is supposed to change the white in the French flag to aqua (Aqua is made by mixing blue and green with no red). Arrange and indent the blocks to make a correct program. You will not use them all.
from image import *
img = Image("fr-flag.gif")
win = ImageWin(img.getWidth(),img.getHeight())
img.draw(win)
---
for p in img.getPixels():
---
r = p.getRed()
g = p.getGreen()
b = p.getBlue()
---
if r > 250 and g > 250 and b > 250:
---
if r < 250 and g < 250 and b < 250: #paired
---
p.setRed(0)
p.setGreen(250)
p.setBlue(250)
---
img.updatePixel(p)
Hint: The green pixels are not pure green. They have almost as much red as they do green. A sample color value might be 111 red, 115 green, and 65 blue. However, the tan pixels also have a lot of green. A tan pixel might have the colors: 177 red, 129 green, 53 blue. Notice that the tan one has a lot more red than the green pixels. Make sure your recipe selects things that have a lot of green, but also do not have too much red.
Write the function isYellow that accepts red, green, and blue values as its parameters and returns True if both the green and red values are at least 40 more than the blue value. Otherwise, it should return False.
Hint: Start by writing a function that returns True always. That will let you run the program but will change every pixel. Then add a condition to say True or False based on the r, g, b values passed in.