View the step-by-step solution to:

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

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question