Image processing with Python

Introduction of PIL

Use PIL (Python Imaging Library)

Click here for PIL http://www.lifewithpython.com/2013/09/pil.html

download

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 the image

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

(Bonus) Read and write QR code

http://nixeneko.hatenablog.com/entry/2016/01/25/023703 http://qiita.com/kiyota-yoji/items/7fe134a64177ed708fdd

Recommended Posts

Image processing with Python
Image processing with Python (Part 2)
Image processing with Python (Part 1)
Image processing with Python (Part 3)
[Python] Image processing with scikit-image
python image processing
Image processing with Python 100 knocks # 3 Binarization
Image processing with Python 100 knocks # 2 Grayscale
Image processing with MyHDL
Image Processing with PIL
Image processing with Python 100 knock # 10 median filter
Image processing with Python 100 knocks # 8 Max pooling
Image processing with Python & OpenCV [Tone Curve]
Image processing with Python 100 knock # 12 motion filter
Drawing with Matrix-Reinventor of Python Image Processing-
Easy image processing in Python with Pillow
Image processing with Python 100 knocks # 7 Average pooling
Light image processing with Python x OpenCV
Image processing with Python 100 knocks # 9 Gaussian filter
Image processing with PIL (Pillow)
"Apple processing" with OpenCV3 + Python3
Image editing with python OpenCV
Acoustic signal processing with Python (2)
Acoustic signal processing with Python
Sorting image files with Python (2)
Sorting image files with Python (3)
Image processing from scratch with python (4) Contour extraction
Image Processing with Python Environment Setup for Windows
Tweet with image in Python
Sorting image files with Python
Image processing by python (Pillow)
Image Processing Collection in Python
Cut out an image with python
Real-time image processing basics with opencv
[Python] Using OpenCV with Python (Image Filtering)
[Python] Easy parallel processing with Joblib
100 Language Processing Knock with Python (Chapter 1)
[Python] Using OpenCV with Python (Image transformation)
100 Language Processing Knock with Python (Chapter 3)
Personal notes for python image processing
Find image similarity with Python + OpenCV
Send image with python, save with php
Gradation image generation with Python [1] | np.linspace
[Image processing] Posterization
FizzBuzz with Python3
Scraping with Python
Statistics with python
Scraping with Python
Python with Go
Integrate with Python
Python file processing
AES256 with python
Tested with Python
python starts with ()
with syntax (Python)
[Let's play with Python] Image processing to monochrome and dots
Bingo with python
Zundokokiyoshi with python
Image processing 100 knocks ①
Excel with Python
Microcomputer with Python