In this mini-lab you will gain practice with using Python for loops
to process all pixels in a picture.
# Mini-Lab: Functions that Manipulate Pixels in a
Picture
# Your Name
# Today's Date
# Recipe 8 from p. 56: Reduce the amount of red in a picture by 50%
When running this function, you can use
a "hard-coded" file name, as in the example at the bottom of p.
56, or you can use the pickAFile function from previous labs;
for example:
picture = makePicture(pickAFile())
Debugging Tip: If the function does not work correctly, check that you remembered the colon at the end of the first line of the function definition and that you spelled all of your variable names and function names correctly. After any edits, remember to click on the Load button before calling your function.
Analysis Questions: What similarities do you see between thedecreaseRedfunction of Recipe 8 and theincreaseRedfunction of Recipe 9? What differences are there between the two functions?
showRedChannel that sets the blue and
green values for each pixel in an image to be equal to the red
value. For example, a pixel with the value (RED=123, GREEN=18,
BLUE=222) would be changed to (RED=123, GREEN=123,
BLUE=123).
Analysis
Questions: How does showRedChannel affect
the appearance of your picture? What happens to regions of the
original picture that were red? What happens to regions of the
picture that were blue?