9951 explained code solutions for 126 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

import Pillow package modules


open given image with Pillow


paste given image to the current image


image to paste to im

(0, 0)

x and y coordinates to paste image to


displays resulting image