Introduction of Python Imaging Library (PIL) using HomeBrew

Note that I had to use PIL for various purposes PIL is a library for drawing (image generation, processing) in Python.

HomeBrew introduction method is omitted

Python was installed on the Mac (not dropped by HomeBrew)

python


brew install pil
ln -s /usr/local/Cellar/pil/1.1.7/lib/python2.7/site-packages/PIL /Library/Python/2.7/site-packages/PIL

Feeling like symlinking where the PIL is where the Python side is trying to use (nothing in that direction)? I couldn't do import image just by installing it.

Execution check Start python

python


>>> from PIL import Image,ImageDraw
>>> img = Image.new('RGB', (200,200),(255,255,255)) # 200*200 white background
>>> draw = ImageDraw.Draw(img) 
>>> draw.line((20,50,150,80),fill=(255,0,0)) #Red straight line
>>> draw.line((150,150,20,200),fill=(0,255,0)) #Green straight line
>>> draw.text((40,80),'Hello',(0,0,0)) #Black letters
>>> img.save('test.jpg','JPEG')  # test.Save as jpg

Execution result test.jpg

Recommended Posts

Introduction of Python Imaging Library (PIL) using HomeBrew
Create an image file using PIL (Python Imaging Library).
PIL (Python Imaging Library) installation memorandum
Introduction of Python
Introduction of Python
Chord recognition using chromagram of python library librosa
Python & Machine Learning Study Memo ②: Introduction of Library
[Introduction to Python] Basic usage of the library matplotlib
Recommendation of binpacking library of python
Introduction of activities applying Python
python: Basics of using scikit-learn ①
Introduction of caffe using pyenv
Convert images to sepia toning with PIL (Python Imaging Library)
A sample for drawing points with PIL (Python Imaging Library).
Image capture of firefox using python
Introduction to Python Numerical Library NumPy
Removal of haze using Python detailEnhanceFilter
Change the Python version of Homebrew
Using Cloud Storage from Python3 (Introduction)
Implementation of desktop notifications using Python
Introduction of python drawing package pygal
Record of Python introduction for newcomers
Python: Basics of image recognition using CNN
Automatic collection of stock prices using python
About building GUI using TKinter of Python
(Bad) practice of using this in Python
General Theory of Relativity in Python: Introduction
Introduction to Discrete Event Simulation Using Python # 1
Installation method using the pip command of the Python package (library) Mac environment
Python: Application of image recognition using CNN
Install python library on Lambda using [/ tmp]
Easy introduction of speech recognition with Python
Introduction of Go's RDB access library (go-pg/pg)
Study on Tokyo Rent Using Python (3-1 of 3)
Publish your own Python library with Homebrew
Introduction to Discrete Event Simulation Using Python # 2
Easy introduction of python3 series and OpenCV3
[Introduction to Data Scientists] Basics of Python ♬
Meaning of using DI framework in Python
[Hyperledger Iroha] Create an account using Python library
[Personal memo] julia --Using Python library with julia using PyCall
Time variation analysis of black holes using python
[Introduction to Udemy Python 3 + Application] 26. Copy of dictionary
Aggregate test results using the QualityForward Python library
[Introduction to Udemy Python 3 + Application] 19. Copy of list
[Python of Hikari-] Chapter 08-04 Module (Installation of external library)
Character encoding when using csv module of python 2.7.3
Python unit test library Nose option introduction-19 types-
Kyoto University Python Lecture Material: Introduction of Columns
Try using the collections module (ChainMap) of python3
Anonymous upload of images using Imgur API (using Python)
Find the geometric mean of n! Using Python
Python introductory study-output of sales data using tuples-
Summary of Excel operations using OpenPyXL in Python
[Introduction to Python] Basic usage of lambda expressions
Python 3.6 email library
Introduction of scikit-optimize
Python ast library
[Introduction to Python] Basic usage of the library scipy that you absolutely must know
Start using Python
Basics of Python ①