Question: Make a function that brightens the original. To do this, multiply each color # value by 2. Some values * 2 will be larger than
Make a function that brightens the original. To do this, multiply each color
# value by 2. Some values * 2 will be larger than the allowed 0-255 range for a color.
# The graphics module sets all values bigger than 255 to 255.
Starting Code
def red_part_of_an_image(image): red_image = image.clone() # copy the image # go across the image with the for x loop and then move down a row for y in range(0,image.getHeight()): for x in range(0,image.getWidth()): color = image.getPixel(x,y) # get the pixel color red_color = color[0] # pull out the red component new_color = [red_color, 0, 0] # Zero out the green and blue red_image.setPixel(x,y, new_color) # Set the pixel to the new color return red_image # return the finished new image
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
