I am attempting to define a function that will blur an image in python without the use of PIL. The color of each pixel needs to be averaged with the colors of the 8 surrounding pixels i.e.:
The value of o needs to be averaged with all the values of x.
x x x
x o x
x x x
I have:
def blur():
global photo
pixels = Image.getPixels(photo)
for row in range(photo.height()):
for col in range(photo.width()):
red = pixels[row][col][0]
green = pixels[row][col][1]
blue = pixels[row][col][2]
Image.setPixels(photo,pixels)
Where Image.getPixels() returns the red, green, and blue values between 0 and 255 in the same list ([0] returns red, [1] returns green, and [2] returns blue) and their x and y values represented by row and col. I have searched fairly extensively for a hint in the right direction but haven't found anything all that relevant. Any idea/help would be appreciated. Thanks!