The problem is that the "if-else" command doesn't work properly. the program always returns entire "else" commands means all black pixels in end.bmp . but there is some pixels that have the same values "(224 238 223)" in "model1.jpg ".
thanks for your help.
Code :
thanks for your help.
Code :
Code:
import Image
model1 = Image.open("model1.jpg")
test = Image.open("test.jpg")
im = Image.new("RGB",(500,500))
rr1=224
gg1=238
bb1=223
for i in range(500):
for j in range(500):
rtest,gtest,btest=test.getpixel((i,j))
r1,g1,b1=model1.getpixel((i,j))
if r1==rr1 & g1==gg1 & b1==bb1:
realtestr=rtest
realtestg=gtest
realtestb=btest
else:
realtestr=0
realtestg=0
realtestb=0
im.putpixel((i,j),(realtestr,realtestg,realtestb)),
im.save('end.bmp')
im.show()
Comment