< Back

Lab 9: Images


Brighten Picture

In a file called bright.py, write a function called increase_brightness(picture). This function should alter the pixels stored inside of the picture object, so that the entire image is now brighter. Your function should then display the new, brighter image.

Example

Before After

Hint

Use the makePicture function to create a picture in JES. You can use the show function to display the image to check to make sure it works.

The getPixels(a_picture) function returns a collection of all of the pixels in an image. You can use this function, as well as a for loop to examine and modify each pixel in an image.

The getRed, getGreen, and getBlue functions will give you the current color of a pixel.

The setRed, setGreen, and setBlue functions will let you set the color of a pixel.

In order to brighen the image, you want to increase all of the color values for each pixel by the same fixed amount.