- Write a program that has three functions: sepia(), remove_all_red(), and gray_scale().
Sepia Tone images are those brownish colored images that may remind you of times past. The formula for creating a sepia tone is as follows:
newR = (R Γ 0.393 + G Γ 0.769 + B Γ 0.189)
newG = (R Γ 0.349 + G Γ 0.686 + B Γ 0.168)
newB = (R Γ 0.272 + G Γ 0.534 + B Γ 0.131)
Red removal from an image:
Simply set the R component to 0.
Gray scale conversion:
newR = (R Γ 0.289 + G Γ 0.587 + B Γ 0.114)
newG = (R Γ 0.289 + G Γ 0.587 + B Γ 0.114)
newB = (R Γ 0.289 + G Γ 0.587 + B Γ 0.114)
Β
Hint: Remember that rgb values must be integers between 0 and 255.
You can get each pixel by using p = img.getPixel(col, row)
Components of each pixel can be retrieved by p.getRed(), p.getGreen(), p.getBlue()
| #Starter code import image img = image.Image(“sample.jpg”) img.draw(win)
|








