Joseph Drackey

Generation

generate functionTue, 28 Mar 2023

Converts an image to grayscale using the crude average of the r, g, and b

from PIL import Image import numpy as np def imageToGrayScale(imageName): im = Image.open(imageName) grayIm = im.convert('LA') grayIm.save('gray' + imageName) imageToGrayScale("lena.png")

Questions about programming?Chat with your personal AI assistant