subject

Please help I wrote this code to just filter over an image not completing turn it the color blue red or green. How do I have the code filter the image and still show the image but with a red filter or green or blue. thank you

# Constants for the image
IMAGE_URL = "https://codehs. com/uploads/c709d869e62686611c1ac84 9367b3245"
IMAGE_WIDTH = 420
IMAGE_HEIGHT = 300
IMAGE_LOAD_TIME = 1000

image = Image(IMAGE_URL)
image. set_size(IMAGE_WIDTH, IMAGE_HEIGHT)
add(image)

"""
Filter that takes an image as a parameter
and applies a filter, then returns the filtered image
"""
# asks the user to input a color of choice

user_color = input("Pick a color, blue, red or green:")

if user_color == "red":
red = 255
green = 0
blue = 0

if user_color == "green":
red = 0
green = 255
blue = 0

if user_color == "blue":
red = 0
green = 0
blue = 255

def custom_filter(image):
for x in range(image. get_width()):
for y in range(image. get_height()):
image. set_blue(x, y,blue)
image. set_red(x, y,red)
image. set_green(x, y,green)

return image

def change_image():
global image
image = custom_filter(image)

timer. set_timeout(change_image, IMAGE_LOAD_TIME)

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 08:30
All of these are true about using adhesive except: a. dissimilar materials can be joined. b. mixing tips are product and material specific. c. a specific application gun may be required. d. two-part adhesives are dispensed using two mixing tips
Answers: 3
question
Computers and Technology, 23.06.2019 20:00
Me ajude por favor , coloquei uma senha e não consigo tira-la no chorme
Answers: 2
question
Computers and Technology, 23.06.2019 21:40
language consists of basic components, and they are called a. 3; mental images, concepts, and speech b. 2; language acquisition and linguistic relativity c. 3; heuristics, algorithms, and analogies d. 4; phonemes, morphemes, syntax, and semantics e. 2; words and grammar
Answers: 3
question
Computers and Technology, 23.06.2019 22:30
Lakendra finished working on her monthly report. in looking it over, she saw that it had large blocks of white space. what steps could lakendra take to reduce the amount of white space?
Answers: 3
You know the right answer?
Please help I wrote this code to just filter over an image not completing turn it the color blue r...
Questions
question
Mathematics, 26.10.2020 21:30
question
Mathematics, 26.10.2020 21:30
question
Biology, 26.10.2020 21:30
Questions on the website: 13722360