from PIL import Image

#Import the image and make pixel list
myImage = Image.open("ele2.jpg")
imageData = myImage.getdata()
pixelList = list(imageData)

newPixelList = []

#pixel manipulation
for pixel in pixelList:
    red = pixel[0]
    green = pixel[1]
    blue = pixel[2]


    #find average of color values
    average = ((red + green + blue) // 3)


    #create new pixel
    newRed = average
    newGreen = average
    newBlue = average

    p = (newRed,newGreen,newBlue)
    #p = (average,average,average)
    

    #add pixel to new pixel list
    newPixelList.append(p)

#open the image
newImage = Image.new("RGB",myImage.size)
newImage.putdata(newPixelList)
newImage.show()
#newImage.save("newPhoto.jpeg","jpeg")

29c082d476c5d225f0876c75c3c8156b68c66485
<mask token>

<mask token>
for pixel in pixelList:
    red = pixel[0]
    green = pixel[1]
    blue = pixel[2]
    average = (red + green + blue) // 3
    newRed = average
    newGreen = average
    newBlue = average
    p = newRed, newGreen, newBlue
    newPixelList.append(p)
<mask token>
newImage.putdata(newPixelList)
newImage.show()

<mask token>
myImage = Image.open('ele2.jpg')
imageData = myImage.getdata()
pixelList = list(imageData)
newPixelList = []
for pixel in pixelList:
    red = pixel[0]
    green = pixel[1]
    blue = pixel[2]
    average = (red + green + blue) // 3
    newRed = average
    newGreen = average
    newBlue = average
    p = newRed, newGreen, newBlue
    newPixelList.append(p)
newImage = Image.new('RGB', myImage.size)
newImage.putdata(newPixelList)
newImage.show()

from PIL import Image
myImage = Image.open('ele2.jpg')
imageData = myImage.getdata()
pixelList = list(imageData)
newPixelList = []
for pixel in pixelList:
    red = pixel[0]
    green = pixel[1]
    blue = pixel[2]
    average = (red + green + blue) // 3
    newRed = average
    newGreen = average
    newBlue = average
    p = newRed, newGreen, newBlue
    newPixelList.append(p)
newImage = Image.new('RGB', myImage.size)
newImage.putdata(newPixelList)
newImage.show()

from PIL import Image

#Import the image and make pixel list
myImage = Image.open("ele2.jpg")
imageData = myImage.getdata()
pixelList = list(imageData)

newPixelList = []

#pixel manipulation
for pixel in pixelList:
    red = pixel[0]
    green = pixel[1]
    blue = pixel[2]


    #find average of color values
    average = ((red + green + blue) // 3)


    #create new pixel
    newRed = average
    newGreen = average
    newBlue = average

    p = (newRed,newGreen,newBlue)
    #p = (average,average,average)
    

    #add pixel to new pixel list
    newPixelList.append(p)

#open the image
newImage = Image.new("RGB",myImage.size)
newImage.putdata(newPixelList)
newImage.show()
#newImage.save("newPhoto.jpeg","jpeg")
