Negative Filter: 4 points
Grayscale Filter: 4 points
Now, you will implement two functions that modify the image as described below. As always, begin by making an imagecopy
variable to become the filtered image that gets returned at the end of the function. For a reminder about how to make a copy, please see the Warmup. For more information about how to use the picture module to modify an image, please refer to the documentation. Note that all of the variables you use in your functions should be local, not global, variables.
The negative of an image is created by inverting each color channel. So if the red value of a pixel were 255, it should become 0. If it were 254, it should become 1, and so on, down to 0 (which should become 255). Similarly for green and blue.
Reminder
Once your filter is complete, don’t forget to commit and push your changes!
Shades of gray have the same red, green, and blue value. To convert an image to grayscale, you should set the red, green, and blue values all to the average value of the three channels of the original pixel. This filter is the grayscale filter you designed in the warmup, meaning that you can use an import warmupgram
statement at the top of your file and call the function with dot notation.
Once you’ve implemented a function, update your placeholder for it in the looping menu. Make sure to test it both on its own and in combination with other filters!
Reminder
Once this is working don’t forget to commit and push your changes before moving on.