U E D R , A S I H C RSS

캠이랑놀자/보창

import Image

def fixRGB(rgbValue, degree):
r = fixIndex(rgbValue0, 0)
g = fixIndex(rgbValue1, 0)
b = fixIndex(rgbValue2, degree)
return r, g, b
def fixIndex(value, degree):
if value + degree > 255:
value = 255
else:
value += degree
return value
im = Image.open("lena.jpg")

"""
newR = Image.new("RGB", im.size)
newG = Image.new("RGB", im.size)
newB = Image.new("RGB", im.size)
newGray = Image.new("P", im.size)
"""
newWhite = Image.new("RGB", im.size)
newDark = Image.new("RGB", im.size)

sizeX, sizeY = im.size

for x in range(0,100):
for y in range(0,100):
srcR, srcG, srcB = im.getpixel((x+40,y+150))
desR, desG, desB = im.getpixel((x, y))
im.putpixel((x,y),((srcR+desR)/2,(srcG+desG)/2,(srcB+desB)/2))

"""
nr, ng, nb = fixRGB(color, 100)
im.putpixel((x,y),(nr,ng,nb))
newR.putpixel((x,y),(r,0,0))
newG.putpixel((x,y),(0,g,0))
newB.putpixel((x,y),(0,0,b))
newGray.putpixel((x,y), (r+g+b)/3)
"""

im.show()

"""
newR.show()
newG.show()
newB.show()
newGray.show()
"""

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-05-27 07:09:19
Processing time 0.0099 sec