Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can you help me . the outpot ask me to enter the image file name: what I can write here Darkening an image requires adjusting
Can you help me . the outpot ask me to enter the image file name: what I can write here
Darkening an image requires adjusting its pixels toward black as a limit, whereas lightening an image requires adjusting them toward white as a limit. Because black is RGB (0,0,0) and white is RGB (255, 255, 255), adjusting the three RGB values of each pixel by the same amount in either direction will have the desired effect. Of course, the algorithms must avoid exceeding either limit during the adjustments. Lightening and darkening are actually special cases of a process known as color filtering. A color filter is any RGB triple applied to an entire image. The filtering algorithm adjusts each pixel by the amounts specified in the triple. For example, you can increase the amount of red in an image by applying a color filter with a positive red value and green and blue values of O. The filter (20,0,0) would make an image's overall color slightly Instructions make an image's overall color slightly redder. Alternatively, you can reduce the amount of red by applying a color filter with a negative red value. Once again, the algorithms must avoid exceeding the limits on the RGB values. Develop three algorithms for lightening. darkening, and color filtering as three related Python functions, lighten. darken, and colorFilter. The first two functipns should expect an image and a positive integer as arguments. The third function should expect an image and a tuple of integers (the RGB values) as arguments. The following session shows how these functions can be used with the hypothetical images image1, image2. and image3, which are initially transparent: >)image1=Image(100,50)>image2=Image(100,50)image3=Image(100,50)>lighten(image1,128)#Conver>darken(image2,64)#Converts)colorFilter(image3,(255,0, Note that the function colorFilter should do most of the work. An example of the program is shown below: Lighten Image \& Darkened image sandbox \$ python 3 colorfilter.py Enter the image file name Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started