简体   繁体   中英

Python pillow automated image editing

I am new to pillow but as far as my knowledge goes I understand that pillow can help me. I want to automatically edit picture that a user uploads.

for example automatically edit this在此处输入图片说明 or在此处输入图片说明 在此处输入图片说明

to this在此处输入图片说明 or this在此处输入图片说明 accordingly.

Is it possible with pillow? how should i tackle/approach this?

You can try using the .blend method.

For two images image1 and image2 :

from PIL import Image
image1 = Image.open(path1)
image2 = Image.open(path2)
new_image = Image.blend(image1, image2, alpha)
#save / do stuff

Alternatively, if you want to specify coordinates:

 image1.paste(image2, (x, y), mask)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM