Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

I am using python and tries to write a main function that calls three other functions and display three picture effects.

I am using python and tries to write a main function that calls three other functions and display three picture effects. The three functions I use are to lighten, darken and grayscale the original picture. But when I wanted them to show simultaneously in the main function, only one picture is shown instead of three(I used the program below). Do I necessarily need to copy three pictures to a canvas?

def main(picture):

 show(lighten(picture))

 show(darken(picture))

 show(grayscale(picture))

def lighten(picture):

 for px in getPixels(picture):

  color=getColor(px)

  color=makeLighter(color)

  setColor(px,color)

 return picture

def darken(picture):

 for px in getPixels(picture):

  color=getColor(px)

  color=makeDarker(color)

  setColor(px,color)

 return picture

def grayscale(picture):

 for px in getPixels(picture):

  intensity=(getRed(px)+getBlue(px)+getGreen(px))/3

  setColor(px,makeColor(intensity,intensity,intensity))

 return picture

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question