hi
the problem is a syntax error that highlights pink the "elif" in the program just that. this code is to water mark picture "test.jpg" with the water mark of "model.jpg" with a mark on a white background the cod is:
the problem is a syntax error that highlights pink the "elif" in the program just that. this code is to water mark picture "test.jpg" with the water mark of "model.jpg" with a mark on a white background the cod is:
Code:
import Image,math
model = Image.open("model.jpg")
test = Image.open("test.jpg")
x=test.size[0]
y=test.size[1]
im = Image.new("RGB",(x,y))
for i in range(300):
for j in range(300):
rpixel,gpixel,bpixel=test.getpixel((i,j))
rmodel,gmodel,bmodel=model.getpixel((i,j))
if 255==rmodel and 255==gmodel and 255==bmodel:
im.putpixel((i,j),(rpixel,gpixel,bpixel)
elif rmodel!=255 or gmodel!=255 or bmodel!=255:
rrr=int((1.2*rpixel-45))
ggg=int((1.2*gpixel-45))
bbb=int((1.2*bpixel-45))
im.putpixel((i,j),(rrr,ggg,bbb)
im.save('end.bmp')
im.show()
Comment