Home > Backend Development > Python Tutorial > python实现基于两张图片生成圆角图标效果的方法

python实现基于两张图片生成圆角图标效果的方法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-10 15:16:53
Original
1827 people have browsed it

本文实例讲述了python实现基于两张图片生成圆角图标效果的方法。分享给大家供大家参考。具体分析如下:

使用pil的蒙版功能,将原图片和圆角图片进行叠加,并将圆角图片作为mask,生成新的圆角图片

from PIL import Image
flower = Image.open('flower.png')
border = Image.open('border.png')
source = border.convert('RGB')
flower.paste(source, mask=border)
flower.save("round.png")
Copy after login

希望本文所述对大家的Python程序设计有所帮助。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template