Joseph Drackey

Generation

generate functionTue, 28 Mar 2023

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 posterize(image, rgb): for pixel in image.getPixels(): pixel.red = rgb[0] pixel.green = rgb[1] pixel.blue = rgb[2] return image

Questions about programming?Chat with your personal AI assistant