Skip to content

Commit 51bef06

Browse files
committed
Fixed error
1 parent b467493 commit 51bef06

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

AveragingAlgo-BW.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Author Bhargav K
22
33
# Averaging algorithm
4-
# gray = (red+green+blue)/2
4+
# gray = (red+green+blue)/3
55

66
from PIL import Image
77
i = Image.open("input.png")
@@ -16,6 +16,6 @@
1616
for image_width_iterator in range(width):
1717
for image_height_iterator in range(height):
1818
cpixel = pixels[image_width_iterator, image_height_iterator]
19-
gray = int(((cpixel[0])+(cpixel[1])+(cpixel[2]))/2)
19+
gray = int(((cpixel[0])+(cpixel[1])+(cpixel[2]))/3)
2020
j.putpixel((image_width_iterator,image_height_iterator),(gray,gray,gray))
2121
j.save('output.png')

0 commit comments

Comments
 (0)