使用pil的蒙版功能,将原图片和圆角图片进行叠加,并将圆角图片作为mask,生成新的圆角图片
转自:http://hi.baidu.com/leejun_2005/item/7ca4a7890f7af8c398255f9a
flower = Image.open('flower.png') border = Image.open('border.png') source = border.convert('RGB') flower.paste(source, mask=border) flower.save("round.png")