2948 explained code solutions for 75 technologies


python-pillowUsing mask to merge two images


from PIL import Image

im = Image.open('/var/www/examples/heroine.png')
im_merge = Image.open('/var/www/examples/hammer.png')

im.paste(im_merge, (0, 0))

im.show()ctrl + c
PIL

import Pillow package modules

Image.open

open given image with Pillow

.paste(

paste given image to the current image

im_merge

image to paste to im

(0, 0)

x and y coordinates to paste image to

.show()

displays resulting image