Use PIL (Python Imaging Library)
Click here for PIL http://www.lifewithpython.com/2013/09/pil.html
http://www.pythonware.com/products/pil/ Please download the one that suits your OS etc. from the official website
After downloading and moving to that folder, follow the steps below to install.
cd Imaging-1.1.7
sudo python setup.py install
mask.py
from PIL import Image, ImageOps
mask = Image.open("Mask image path")
org = Image.open("Original image path")
sq = ImageOps.fit(sq, (400, 400), method = Image.LANCZOS)
sq.putalpha(mask.convert("L"))
sq.save("Path to save the image cut out in a circle")
http://nixeneko.hatenablog.com/entry/2016/01/25/023703 http://qiita.com/kiyota-yoji/items/7fe134a64177ed708fdd
Recommended Posts