Get the answers you need at Westonci.ca, where our expert community is dedicated to providing you with accurate information. Ask your questions and receive detailed answers from professionals with extensive experience in various fields. Our platform provides a seamless experience for finding reliable answers from a network of experienced professionals.
Sagot :
PLEASE HELP ME FIX THIS CODE.
I WANT IT TO HAVE USER INPUT TO CHANGE AND IMAGE FILTER TO BLUE RED OR GREEN.
user_color = input("What color would you like to paint the canvas, blue, red or green?:")
def user_red(pixel):
pixel[0] = 100 + pixel[0]
pixel[1] = 100 - pixel[1]
pixel[2] = 100 - pixel[2]
return pixel
def user_green(pixel):
pixel[0] = 100 + pixel[0]
pixel[1] = 100 - pixel[1]
pixel[2] = 100 - pixel[2]
return pixel
def user_blue(pixel):
pixel[0] = 100 + pixel[0]
pixel[1] = 100 - pixel[1]
pixel[2] = 100 - pixel[2]
return pixel
def custom_filter(image, user_color):
for x in range(image.get_width()):
for y in range(image.get_height()):
pixel = image.get_pixel(x,y)
new_colors = invert_pixel(pixel)
image.set_red(x, y, new_colors[0])
image.set_green(x, y, new_colors[1])
image.set_blue(x, y, new_colors[2])
return image
def change_image():
global image
image = custom_filter(image, user_color)
timer.set_timeout(change_image, IMAGE_LOAD_TIME)
We hope you found what you were looking for. Feel free to revisit us for more answers and updated information. Thanks for using our platform. We aim to provide accurate and up-to-date answers to all your queries. Come back soon. We're here to help at Westonci.ca. Keep visiting for the best answers to your questions.