U E D R , A S I H C RSS

캠이랑놀자/아영

~cpp

import Image

print "Testing..."

im = Image.open("lena.jpg")
im1 = Image.new("RGB", im.size)
im2 = Image.new("P", im.size)
im3 = Image.new("P", im.size)

t = im.size

#print t


for x in range(50,100):
	for y in range(50,100):
		r,g,b = im.getpixel((x,y))
		im.putpixel((x,y), (r+30,g+30,b+30))

for x in range(100,150):
	for y in range(100,150):
		r,g,b = im.getpixel((x,y))
		im.putpixel((x,y), (r-30,g-30,b-30))

for x in range(150,200):
	for y in range(150,200):
		r,g,b = im.getpixel((x,y))
		im.putpixel((x,y), (r,g,b+30))
"""
for x in range(256):
	for y in range(256):
		r,g,b = im.getpixel((x,y))
		im2.putpixel((x,y), g)


for x in range(256):
	for y in range(256):
		r,g,b = im.getpixel((x,y))
		im3.putpixel((x,y), b)

"""


im.show()
#im2.show()
#im3.show()


~cpp
import Image

print "Testing..."

im = Image.open("lena.jpg")
im1 = Image.new("RGB", im.size)
im2 = Image.new("P", im.size)
im3 = Image.new("P", im.size)

t = im.size

#print t


for x in range(256):
	for y in range(124):
		r1,g1,b1 = im.getpixel((x,y))
	for y in range(125,256):
		r2,g2,b2 = im.getpixel((x,y))
		newR = (r1+r2)/2
		newG = (g1+g2)/2
		newB = (b1+b2)/2
		im.putpixel((x,y), (newR,newG,newB))

"""
for x in range(256):
	for y in range(256):
		r,g,b = im.getpixel((x,y))
		im2.putpixel((x,y), g)


for x in range(256):
	for y in range(256):
		r,g,b = im.getpixel((x,y))
		im3.putpixel((x,y), b)

"""


im.show()
#im2.show()
#im3.show()


06 01 13



~cpp
import Image

im2 = Image.open("lena.jpg")
im = Image.open("lena_modified.jpg")
im3 = Image.new("RGB",im.size)

for x in range(im.size[0]):
	for y in range(im.size[1]):
		r,g,b = im.getpixel((x,y))
		r2,g2,b2 = im2.getpixel((x,y))
		newR = r-r2
		newG = g-g2
		newB = b-b2

		if((newR) < 0):
			newR = im.size[0] - (newR+im.size[0])
		if((newG) < 0):
			newG = im.size[0] - (newG+im.size[0])
		if((newB) < 0):
			newB = im.size[0] - (newB+im.size[0])
		im3.putpixel((x,y), (newR, newG, newB))

im3.show()


Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:31:17
Processing time 0.0061 sec