캠이랑놀자/아영/숙제1 ¶
RGB channel만들기 ¶
즉석해서 써봅니다. editPlus가 안되서 ,ㅠ cmd로 실행한거 모아볼께용^^
~cpp //2005.12.29 import Image im = Image.open("lena.jpg") imR = Image.new("RGB", im.size) imG = Image.new("RGB", im.size) imB = Image.new("RGB", im.size) #제가 받은 파일은 512 size더라구요. for x in range(512): for y in range(512): r,g,b = im.getpixel((x,y)) imR.putpixel((x,y), (r, 0, 0)) imG.putpixel((x,y), (0, g, 0)) imB.putpixel((x,y), (0, 0, b)) imR.show() imG.show() imB.show()
RGB 별 Gray화 ¶
~cpp //2005.12.30 import Image im = Image.open("lena.jpg") imR = Image.new("P", im.size) imG = Image.new("P", im.size) imB = Image.new("P", im.size) for x in range(512): for y in range(512): r,g,b = im.getpixel((x,y)) imR.putpixel((x,y), r) imG.putpixel((x,y), g) imB.putpixel((x,y), b) imR.show() imG.show() imB.show()
여기서 붉은 색이 가장 밝게 나타남.
Whitening ¶
~cpp //2005. 12. 31 import Image im = Image.open("lena.jpg") imW = Image.new("RGB", im.size) for x in range(50, 100): for y in range(50, 100): r,g,b = im.getpixel((x,y)) imW.putpixel((x,y), (r+30, g+30, b+30) imW.show()
Darkening ¶
~cpp //2005. 12. 31 import Image im = Image.open("lena.jpg") imD = Image.new("RGB", im.size) for x in range(100, 150): for y in range(100, 150): r,g,b = im.getpixel((x,y)) imD.putpixel((x,y), (r-30, g-30, b-30) imW.show()