Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

Define a function named posterize

Computer Science Jul 27, 2020

Define a function named posterize. This function expects an image

and a tuple of RGB values as arguments. The function modifies the image like the blackAndWhite function developed in Chapter 7 and shown below, but it uses passed in RGB values instead of black.
def blackAndWhite(image):     """Converts the argument image to black and white."""     blackPixel = (0, 0, 0)     whitePixel = (255, 255, 255)     for y in range(image.getHeight()):         for x in range(image.getWidth()):             (r, g, b) = image.getPixel(x, y)             average = (r + g + b) // 3             if average < 128:                 image.setPixel(x, y, blackPixel)             else:                 image.setPixel(x, y, whitePixel) An example of the program is shown below:

Expert Solution

For detailed step-by-step solution, place custom order now.
Need this Answer?

This solution is not in the archive yet. Hire an expert to solve it for you.

Get a Quote
Secure Payment