Hands-On Image Processing with Python
上QQ阅读APP看书,第一时间看更新

Superimposing two images

An image can be superimposed on top of another by multiplying two input images (of the same size) pixel by pixel. The next code snippet shows an example:

im1 = Image.open("../images/parrot.png")
im2 = Image.open("../images/hill.png").convert('RGB').resize((im1.width, im1.height))
multiply(im1, im2).show()

The next figure shows the output image generated when superimposing two images by running the preceding code snippet: