~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()
~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()
~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()
~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()