Python implements the method of generating rounded corner icon effects based on two images

  • 2020-04-02 14:46:17
  • OfStack

This article illustrates a python method for generating rounded corner ICONS based on two images. Share with you for your reference. Specific analysis is as follows:

The mask function of pil is used to overlay the original picture and the rounded corner picture, and the rounded corner picture is used as the mask to generate the new rounded corner picture


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")

I hope this article has helped you with your Python programming.


Related articles: