Skip to content

Commit 8904df6

Browse files
committed
Small Update
1 parent f5673f2 commit 8904df6

9 files changed

+29
-31
lines changed

BitonalAlgo.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Author Sri Vennela Vaishnapu
22
3-
# bi toning algorithm
3+
# Bitonal algorithm
44
#if (pixelBuffer[k] + pixelBuffer[k + 1] +
55
# pixelBuffer[k + 2] <= threshold)
66
# {
@@ -15,13 +15,14 @@
1515
# pixelBuffer[k + 2] = lightColor.R;
1616
# }
1717
from PIL import Image
18-
import random
19-
lightcolor_red=0
20-
lightcolor_blue=139
21-
lightcolor_green=0
22-
darkcolor_red=179
23-
darkcolor_blue=222
24-
darkcolor_green=196
18+
19+
print "Enter values between 0 and 255"
20+
lightcolor_red=input("Enter red value of light color: ")
21+
lightcolor_blue=input("Enter blue value of light color: ")
22+
lightcolor_green=input("Enter green value of light color: ")
23+
darkcolor_red=input("Enter red value of dark color: ")
24+
darkcolor_blue=input("Enter blue value of dark color: ")
25+
darkcolor_green=input("Enter green value of dark color: ")
2526
i = Image.open("input.png")
2627
#pixel data is stored in pixels in form of two dimensional array
2728
pixels = i.load()

Bitwise Blending.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
print "Choose Bitwise blendtypes as follows"
2828
print "1 AND \n2 OR \n3 XOR\n"
2929

30-
redblend=input("Choose red blend type")
31-
greenblend=input("Choose green blend type ")
32-
blueblend=input("Choose blue blend type ")
30+
redblend=input("Choose red blend type: ")
31+
greenblend=input("Choose green blend type: ")
32+
blueblend=input("Choose blue blend type: ")
3333

3434
#cpixel[0] contains red value cpixel[1] contains green value
3535
#cpixel[2] contains blue value cpixel[3] contains alpha value

ColorTintAlgo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
pixels = i.load()
1818
width, height = i.size
1919
j=Image.new(i.mode,i.size)
20-
blueTint=input("enter the percentage of blue tint in fraction")
21-
greenTint=input("enter the percentage of green tint in fraction")
22-
redTint=input("enter the percentage of red tint in fraction")
20+
blueTint=input("Enter the percentage of blue tint in fraction: ")
21+
greenTint=input("Enter the percentage of green tint in fraction: ")
22+
redTint=input("Enter the percentage of red tint in fraction: ")
2323
for x in range(width):
2424
for y in range(height):
2525
cpixel = pixels[x, y]

ColourBalanceAlgo.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
# if (red > 255) {red = 255;}
1212
# else if (red < 0) {red = 0;}
1313
from PIL import Image
14-
i = Image.open("lena.jpg")
15-
print(i.format,i.size,i.mode)
16-
pixels = i.load() # this is not a list, nor is it list()'able
14+
i = Image.open("input.png")
15+
16+
pixels = i.load()
1717
width, height = i.size
1818
j=Image.new(i.mode,i.size)
19-
blueLevelFloat=input("enter the color level for blue which is ranging from 0 to 255")
20-
greenLevelFloat=input("enter the color level for green which is ranging from 0 to 255")
21-
redLevelFloat=input("enter the color level for red which is ranging from 0 to 255")
19+
blueLevelFloat=input("Enter the color level for blue which is ranging from 0 to 255: ")
20+
greenLevelFloat=input("Enter the color level for green which is ranging from 0 to 255: ")
21+
redLevelFloat=input("Enter the color level for red which is ranging from 0 to 255: ")
2222
for x in range(width):
2323
for y in range(height):
2424
cpixel = pixels[x, y]
@@ -40,5 +40,5 @@
4040
elif(outputBlue<0):
4141
outputBlue=0
4242
j.putpixel((x,y),(outputRed,outputGreen,outputBlue))
43-
j.save('colourbal.png')
43+
j.save('output.png')
4444

ColourShadingAlgo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Colour Shading algorithm
44
from PIL import Image
55
import random
6-
i = Image.open("lena.jpg")
6+
i = Image.open("input.png")
77
blueShade = input("enter the ahdingfactor for blue range:0 to 1")
88
redShade = input("enter the ahdingfactor for red range:0 to 1")
99
greenShade = input("enter the ahdingfactor for green range:0 to 1")
@@ -27,4 +27,4 @@
2727
if(red < 0):
2828
red = 0
2929
j.putpixel((x,y),(red,green,blue))
30-
j.save('shading.png')
30+
j.save('output.png')

ContrastAlgo.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
#EndProcedure
1515
from PIL import Image
1616
i = Image.open("input.png")
17-
#debugging purpose
18-
#print(i.format,i.size,i.mode)
17+
1918
#pixel data is stored in pixels in form of two dimensional array
20-
pixels = i.load() # this is not a list, nor is it list()'able
19+
pixels = i.load()
2120
width, height = i.size
2221
j=Image.new(i.mode,i.size)
2322
contrast=input("enter contrast value range:-255 to 255")

ErrorDiffusionAlgo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#EndProcedure
1212

1313
from PIL import Image
14-
i = Image.open("lena.jpg")
14+
i = Image.open("input.png")
1515

1616
#pixel data is stored in pixels in form of two dimensional array
1717
pixels = i.load()
@@ -41,4 +41,4 @@ def Error(value):
4141
j.putpixel((x+1, y ),(int(Truncate(apixel[0] + 0.5 * error_red)),int(Truncate(apixel[1]+0.5*error_blue)),int(Truncate(apixel[2]+0.5*error_green))))
4242
j.putpixel((x , y+1),(int(Truncate(bpixel[0] + 0.5 * error_red)),int(Truncate(bpixel[1]+0.5*error_blue)),int(Truncate(bpixel[2]+0.5*error_green))))
4343

44-
j.save('error.png')
44+
j.save('output.png')

GammaCorrectionAlgo.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
from PIL import Image
1111
import random
1212
i = Image.open("input.png")
13-
#debugging purpose
14-
#print(i.format,i.size,i.mode)
1513
#pixel data is stored in pixels in form of two dimensional array
1614
pixels = i.load() # this is not a list, nor is it list()'able
1715
width, height = i.size

SolarisationAlgo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# Else
1818
# solariseBlue = Blue(colour)
1919
# EndIf
20-
# PutPixelColour(x, y) = RGB(solariseRed, solariseGreen
20+
# PutPixelColour(x, y) = RGB(solariseRed, solariseGreen, solariseGreen)
2121

2222
from PIL import Image
2323
i = Image.open("input.png")

0 commit comments

Comments
 (0)