- Installation¶
- Warnings¶
- Notes¶
- Basic Installation¶
- Windows Installation¶
- macOS Installation¶
- Linux Installation¶
- FreeBSD Installation¶
- Building From Source¶
- External Libraries¶
- Build Options¶
- Building on macOS¶
- Building on Windows¶
- Building on FreeBSD¶
- Building on Linux¶
- Platform Support¶
- Continuous Integration Targets¶
- Other Platforms¶
- Old Versions¶
- Installing PIL/Pillow/cImage for Python on Windows and Mac
- What is Python?
- What is PIL/Pillow?
- What is cImage?
- Installing Python, PIL/Pillow, and cImage.py
- Windows
Installation¶
Warnings¶
Pillow and PIL cannot co-exist in the same environment. Before installing Pillow, please uninstall PIL.
Pillow >= 1.0 no longer supports “import Image”. Please use “from PIL import Image” instead.
Pillow >= 2.1.0 no longer supports “import _imaging”. Please use “from PIL.Image import core as _imaging” instead.
Notes¶
Pillow = 2.0.0 = 4.0.0 supports Python versions 2.7, 3.3, 3.4, 3.5, 3.6
Basic Installation¶
The following instructions will install Pillow with support for most common image formats. See External Libraries for a full list of external libraries supported.
Install Pillow with pip:
Or use easy_install for installing Python Eggs as pip does not support them:
Windows Installation¶
We provide Pillow binaries for Windows compiled for the matrix of supported Pythons in both 32 and 64-bit versions in wheel, egg, and executable installers. These binaries have all of the optional libraries included:
macOS Installation¶
We provide binaries for macOS for each of the supported Python versions in the wheel format. These include support for all optional libraries except OpenJPEG:
Linux Installation¶
We provide binaries for Linux for each of the supported Python versions in the manylinux wheel format. These include support for all optional libraries except Raqm:
Most major Linux distributions, including Fedora, Debian/Ubuntu and ArchLinux also include Pillow in packages that previously contained PIL e.g. python-imaging .
FreeBSD Installation¶
Pillow can be installed on FreeBSD via the official Ports or Packages systems:
Ports:
Packages:
The Pillow FreeBSD port and packages are tested by the ports team with all supported FreeBSD versions and against Python 2.x and 3.x.
Building From Source¶
External Libraries¶
You do not need to install all supported external libraries to use Pillow’s basic features. Zlib and libjpeg are required by default.
There are scripts to install the dependencies for some operating systems included in the depends directory. Also see the Dockerfiles in our docker images repo.
Many of Pillow’s features require external libraries:
- libjpeg provides JPEG functionality.
- Pillow has been tested with libjpeg versions 6b, 8, 9, 9a, and 9b and libjpeg-turbo version 8.
- Starting with Pillow 3.0.0, libjpeg is required by default, but may be disabled with the —disable-jpeg flag.
- zlib provides access to compressed PNGs
- Starting with Pillow 3.0.0, zlib is required by default, but may be disabled with the —disable-zlib flag.
- libtiff provides compressed TIFF functionality
- Pillow has been tested with libtiff versions 3.x and 4.0
- libfreetype provides type related services
- littlecms provides color management
- Pillow version 2.2.1 and below uses liblcms1, Pillow 2.3.0 and above uses liblcms2. Tested with 1.19 and 2.7.
- libwebp provides the WebP format.
- Pillow has been tested with version 0.1.3, which does not read transparent WebP files. Versions 0.3.0 and above support transparency.
- tcl/tk provides support for tkinter bitmap and photo images.
- openjpeg provides JPEG 2000 functionality.
- Pillow has been tested with openjpeg 2.0.0 and 2.1.0.
- Pillow does not support the earlier 1.5 series which ships with Ubuntu /usr or /usr/local ), no additional configuration should be required. If they are installed in a non-standard location, you may need to configure setuptools to use those locations by editing setup.py or setup.cfg , or by adding environment variables on the command line:
If Pillow has been previously built without the required prerequisites, it may be necessary to manually clear the pip cache or build without cache using the —no-cache-dir option to force a build with newly installed external libraries.
Build Options¶
- Environment variable: MAX_CONCURRENCY=n . By default, Pillow will use multiprocessing to build the extension on all available CPUs, but not more than 4. Setting MAX_CONCURRENCY to 1 will disable parallel building.
- Build flags: —disable-zlib , —disable-jpeg , —disable-tiff , —disable-freetype , —disable-tcl , —disable-tk , —disable-lcms , —disable-webp , —disable-webpmux , —disable-jpeg2000 , —disable-imagequant , —disable-raqm . Disable building the corresponding feature even if the development libraries are present on the building machine.
- Build flags: —enable-zlib , —enable-jpeg , —enable-tiff , —enable-freetype , —enable-tcl , —enable-tk , —enable-lcms , —enable-webp , —enable-webpmux , —enable-jpeg2000 , —enable-imagequant , —enable-raqm . Require that the corresponding feature is built. The build will raise an exception if the libraries are not found. Webpmux (WebP metadata) relies on WebP support. Tcl and Tk also must be used together.
- Build flag: —disable-platform-guessing . Skips all of the platform dependent guessing of include and library directories for automated build systems that configure the proper paths in the environment variables (e.g. Buildroot).
- Build flag: —debug . Adds a debugging flag to the include and library search process to dump all paths searched for and found to stdout.
Building on macOS¶
The Xcode command line tools are required to compile portions of Pillow. The tools are installed by running xcode-select —install from the command line. The command line tools are required even if you have the full Xcode package installed. It may be necessary to run sudo xcodebuild -license to accept the license prior to using the tools.
The easiest way to install external libraries is via Homebrew. After you install Homebrew, run:
Then see depends/install_raqm_cmake.sh to install libraqm.
Now install Pillow with:
or from within the uncompressed source directory:
Building on Windows¶
We don’t recommend trying to build on Windows. It is a maze of twisty passages, mostly dead ends. There are build scripts and notes for the Windows build in the winbuild directory.
Building on FreeBSD¶
Only FreeBSD 10 and 11 tested
Make sure you have Python’s development libraries installed.:
Or for Python 3:
Prerequisites are installed on FreeBSD 10 or 11 with:
Then see depends/install_raqm_cmake.sh to install libraqm.
Building on Linux¶
If you didn’t build Python from source, make sure you have Python’s development libraries installed.
In Debian or Ubuntu:
Or for Python 3:
In Fedora, the command is:
Or for Python 3:
redhat-rpm-config is required on Fedora 23, but not earlier versions.
Prerequisites are installed on Ubuntu 14.04 LTS with:
Then see depends/install_raqm.sh to install libraqm.
Prerequisites are installed on Fedora 23 with:
Platform Support¶
Current platform support for Pillow. Binary distributions are contributed for each release on a volunteer basis, but the source should compile and run everywhere platform support is listed. In general, we aim to support all current versions of Linux, macOS, and Windows. Note that Android is not currently supported, but there have been reports of success.
Continuous Integration Targets¶
These platforms are built and tested for every change.
Operating system Tested Python versions Tested Architecture Alpine 2.7 x86-64 Arch 2.7 x86-64 Amazon 2.7 x86-64 Centos 6 2.7 x86-64 Debian Stretch 2.7 x86 Mac OS X 10.10 Yosemite* 2.7, 3.3, 3.4, 3.5, 3.6 x86-64 Ubuntu Linux 16.04 LTS 2.7 x86-64 Ubuntu Linux 14.04 LTS 2.7, 3.3, 3.4, 3.5, 3.6, pypy, pypy3
Ubuntu Linux 12.04 LTS 2.7 x86-64 Windows Server 2012 R2 2.7,3.3,3.4,pypy x86, x86-64 * Mac OS X CI is not run for every commit, but is run for every release.
Other Platforms¶
These platforms have been reported to work at the versions mentioned.
Contributors please test Pillow on your platform then update this document and send a pull request.
Operating system Tested Python versions Latest tested Pillow version Tested processors macOS 10.12 Sierra 2.7,3.4,3.5,3.6 4.1.1 x86-64 Mac OS X 10.11 El Capitan 2.7,3.3,3.4,3.5 4.1.0 x86-64 Mac OS X 10.9 Mavericks 2.7,3.2,3.3,3.4 3.0.0 x86-64 Mac OS X 10.8 Mountain Lion 2.6,2.7,3.2,3.3 x86-64 Redhat Linux 6 2.6 x86 CentOS 6.3 2.7,3.3 x86 Fedora 23 2.7,3.4 3.1.0 x86-64 Ubuntu Linux 12.04 LTS 2.6,2.7,3.2,3.3,3.4,3.5 PyPy5.3.1,PyPy3 v2.4.0
Ubuntu Linux 10.04 LTS 2.6 2.3.0 x86,x86-64 Debian 8.2 Jessie 2.7,3.4 3.1.0 x86-64 Raspian Jessie 2.7,3.4 3.1.0 arm Gentoo Linux 2.7,3.2 2.1.0 x86-64 FreeBSD 11.0 2.7,3.4,3.5,3.6 4.2.0 x86-64 FreeBSD 10.3 2.7,3.4,3.5 4.2.0 x86-64 FreeBSD 10.2 2.7,3.4 3.1.0 x86-64 Windows 8.1 Pro 2.6,2.7,3.2,3.3,3.4 2.4.0 x86,x86-64 Windows 8 Pro 2.6,2.7,3.2,3.3,3.4a3 2.2.0 x86,x86-64 Windows 7 Pro 2.7,3.2,3.3 3.4.1 x86-64 Windows Server 2008 R2 Enterprise 3.3 x86-64 Old Versions¶
You can download old distributions from PyPI. Only the latest major releases for Python 2.x and 3.x are visible, but all releases are available by direct URL access e.g. https://pypi.python.org/pypi/Pillow/1.0.
© Copyright 1995-2011 Fredrik Lundh, 2010-2017 Alex Clark and Contributors. Revision bbde1fe6 .
Installing PIL/Pillow/cImage for Python on Windows and Mac
IT Helpdesk
Fill out a ticket at help.stolaf.edu or stop by the IT Helpdesk in RML 353, right off the Rolvaag Memorial Library AtriumHelpdesk Hours
Sunday: 1:30pm – 11pm
Monday – Thursday: 7:45am – 11pm
Friday: 7:45am – 5pm
Saturday: ClosedWhat is Python?
Python is a widely-used programming language used in many of the computer science classes here at St. Olaf.
What is PIL/Pillow?
PIL (Python Imaging Library) adds many image processing features to Python. Pillow is a fork of PIL that adds some user-friendly features.
What is cImage?
cImage.py is a Python module used for image processing.
Installing Python, PIL/Pillow, and cImage.py
Windows
- Install Python 2.7.8 (64-bit — this is important)
- https://www.python.org/ftp/python/2.7.8/python-2.7.8.amd64.msi
- Install Python 3.4.1 (64-bit — this is important)
- https://www.python.org/ftp/python/3.4.1/python-3.4.1.amd64.msi
- Download and install Pillow for Python 2
- https://pypi.python.org/packages/2.7/P/Pillow/Pillow-2.5.3.win-amd64-py2.7.exe#md5=33c3a581ff1538b4f79b4651084090c8
- Download and install Pillow for Python 3
- https://pypi.python.org/packages/3.4/P/Pillow/Pillow-2.5.3.win-amd64-py3.4.exe#md5=6ee659d7b945e826a07c53c15578424f (direct link)
- https://pypi.python.org/pypi/Pillow/ (all other versions)
- https://pypi.python.org/packages/3.4/P/Pillow/Pillow-2.5.3.win-amd64-py3.4.exe#md5=6ee659d7b945e826a07c53c15578424f (direct link)
- Download and install cImage
- Download cImage.py from Github
- Navigate to https://github.com/bnmnetp/cImage
- Click cImage.py, and click the button labeled Raw to see the contents of the file.
- Click File >Save Page As (Chrome & Firefox) or File >Save As (Safari) to save the file on your computer.
- Copy “cImage.py” from where you saved it to C:\Python27\Lib\site-packages and C:\Python34\Lib\site-packages\
- Download cImage.py from Github
- Install Python 3.4.1 (Python 2.7 is already installed by default)
- https://www.python.org/ftp/python/3.4.1/python-3.4.1-macosx10.6.dmg
- Download Xcode from the Mac App Store
- Navigate to Xcode >Preferences >Downloads tab
- Click the button to install the Command Line Tools
- Open Terminal (Applications/Terminal) and run:
- xcode-select –install (You will be prompted to install the Xcode Command Line Tools)
- sudo easy_install pip
- sudo pip install pillow
- pip3.4 install pillow
- Download and install cImage
- Download cimage.py
- Navigate to https://github.com/bnmnetp/cImage
- Click cImage.py, and click the button labeled Raw to see the contents of the file.
- Click File->Save Page As (Chrome & Firefox) or File->Save As (Safari) to save the file on your computer.
- Copy “cImage.py” from where you saved it to Macintosh HD/Library/Python/2.7/site-packages/
- Copy “cImage.py” from where you saved it to Macintosh HD/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/
- Download cimage.py
1520 St. Olaf Avenue
Northfield, MN 55057