2013-06-14 08:20:46 +04:00
Pillow
2010-07-31 06:52:47 +04:00
======
2013-05-12 04:46:51 +04:00
.. Note :: Pillow < 2.0.0 supports Python 2.4, 2.5, 2.6, 2.7; Pillow >= 2.0.0 supports Python 2.6, 2.7, 3.2, 3.3.
2013-03-09 01:07:16 +04:00
2013-03-07 02:55:43 +04:00
.. image :: https://travis-ci.org/python-imaging/Pillow.png
2013-03-21 22:02:21 +04:00
:target: https://travis-ci.org/python-imaging/Pillow
2013-03-07 02:55:43 +04:00
2013-03-07 21:51:48 +04:00
Pillow is the "friendly" PIL fork by Alex Clark and Contributors. PIL is the Python Imaging Library by Fredrik Lundh and Contributors.
2010-07-31 07:03:01 +04:00
2010-11-28 05:44:38 +03:00
Introduction
------------
2010-07-31 07:03:01 +04:00
2013-02-27 21:50:29 +04:00
The fork author's goal is to foster active development of PIL through:
2010-07-31 07:03:53 +04:00
2013-05-12 04:51:46 +04:00
- Continuous integration testing via `Travis CI <https://travis-ci.org/python-imaging/Pillow> `_
- Publicized development activity on `GitHub <https://github.com/python-imaging/Pillow> `_
- Regular releases to the `Python Package Index <https://pypi.python.org/pypi/Pillow> `_
- Solicitation for community contributions and involvement on `Image-SIG <http://mail.python.org/mailman/listinfo/image-sig> `_
2011-09-07 22:10:25 +04:00
2013-06-30 03:06:39 +04:00
Port existing PIL-based code to Pillow
--------------------------------------
2011-09-07 22:10:25 +04:00
2013-05-12 04:25:28 +04:00
Pillow is a functional drop-in replacement for the Python Imaging Library. To run your existing PIL-compatible code with Pillow, it needs to be modified to import the `` Imaging `` module from the `` PIL `` namespace *instead* of the global namespace. I.e. change::
2013-04-09 23:22:26 +04:00
import Image
to::
2013-05-04 04:22:54 +04:00
from PIL import Image
2013-04-09 23:22:26 +04:00
2013-05-12 04:25:51 +04:00
.. Note :: If your code imports from `` _imaging `` , it will no longer work.
2013-05-04 04:04:16 +04:00
2013-05-04 04:30:51 +04:00
The preferred, future proof method of importing the private `` _imaging `` module is::
2013-04-09 23:22:26 +04:00
from PIL import Image
2013-05-04 04:22:54 +04:00
_imaging = Image.core
2013-04-09 23:22:26 +04:00
2013-05-04 04:04:16 +04:00
Why a fork?
-----------
PIL is not setuptools compatible. Please see http://mail.python.org/pipermail/image-sig/2010-August/006480.html for a more detailed explanation. Also, PIL's current bi-yearly (or greater) release schedule is too infrequent to accomodate the large number and frequency of issues reported.
2011-10-27 05:12:43 +04:00
What about image code bugs?
---------------------------
Please report any non-packaging related issues here first:
- https://bitbucket.org/effbot/pil-2009-raclette/issues
Then open a ticket here:
2012-08-23 00:47:36 +04:00
- https://github.com/python-imaging/Pillow/issues
2011-10-27 05:12:43 +04:00
2013-03-08 17:40:36 +04:00
and provide a link to the first ticket so we can track the issue(s) upstream.
2013-05-04 04:42:18 +04:00
.. Note :: Prior to Pillow 2.0.0, very few image code changes were made. Pillow 2.0.0 adds Python 3 support and includes many bug fixes from many contributors.
2010-11-28 05:44:38 +03:00
2012-02-28 01:26:28 +04:00
Documentation
-------------
2013-03-09 02:28:42 +04:00
The API documentation included with PIL has been converted (from HTML generated by pythondoc) to reStructured text (via pandoc) and is now `hosted by readthedocs.org <http://pillow.readthedocs.org> `_ . This is a work in progress: in order to re-generate new API documentation, either `pythondoc <http://effbot.org/zone/pythondoc.htm> `_ will have to be run again or the pythondoc functionality must be converted to Sphinx.
2012-02-28 01:26:28 +04:00
2013-03-09 02:35:40 +04:00
Community
---------
2013-05-12 04:55:06 +04:00
PIL needs you! Please help us maintain the Python Imaging Library here:
2013-03-09 02:35:40 +04:00
2013-05-12 04:55:06 +04:00
- GitHub (https://github.com/python-imaging/Pillow)
- Freenode (irc://irc.freenode.net#pil)
- Image-SIG (http://mail.python.org/mailman/listinfo/image-sig)
2013-03-09 02:35:40 +04:00
2013-05-04 04:45:39 +04:00
Installation
------------
2013-05-16 00:54:49 +04:00
.. Note :: PIL and Pillow currently cannot co-exist in the same environment. If you want to use Pillow, please remove PIL first.
2013-03-14 16:20:08 +04:00
Platform support
2013-05-04 04:45:39 +04:00
~~~~~~~~~~~~~~~~
2013-03-14 16:20:08 +04:00
2013-03-15 16:33:22 +04:00
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, OS X, and Windows.
2013-03-14 16:20:08 +04:00
.. Note :: Contributors please test on your platform, edit this document and send a pull request
2013-03-15 06:18:20 +04:00
+----------------------------------+-------------+------------------------------+-----------------------+
2013-03-15 16:37:00 +04:00
|**Operating system** |**Supported** |**Tested Python versions** |**Tested processors** |
2013-03-15 06:18:20 +04:00
+----------------------------------+-------------+------------------------------+-----------------------+
2013-03-15 16:33:22 +04:00
| Mac OS X 10.8 Mountain Lion |Yes | 2.6,2.7,3.2,3.3 |x86-64 |
2013-03-15 06:18:20 +04:00
+----------------------------------+-------------+------------------------------+-----------------------+
2013-03-16 00:50:59 +04:00
| Mac OS X 10.7 Lion |Yes | 2.7 |x86-64 |
+----------------------------------+-------------+------------------------------+-----------------------+
| Redhat Linux 6 |Yes | 2.6 |x86 |
+----------------------------------+-------------+------------------------------+-----------------------+
2013-03-15 16:33:22 +04:00
| Ubuntu Linux 10.04 LTS |Yes | 2.6 |x86,x86-64 |
2013-03-15 06:18:20 +04:00
+----------------------------------+-------------+------------------------------+-----------------------+
2013-03-15 16:33:22 +04:00
| Ubuntu Linux 12.04 LTS |Yes | 2.6,2.7,3.2,3.3 |x86,x86-64 |
2013-04-21 22:55:58 +04:00
+----------------------------------+-------------+------------------------------+-----------------------+
2013-06-14 08:17:46 +04:00
| Raspian Wheezy |Yes | 2.7,3.2 |arm |
+----------------------------------+-------------+------------------------------+-----------------------+
| Gentoo Linux |Yes | 2.7,3.2 |x86-64 |
2013-03-15 16:05:14 +04:00
+----------------------------------+-------------+------------------------------+-----------------------+
2013-05-25 01:30:14 +04:00
| Windows 7 Pro |Yes | 2.7,3.2 |x86 |
+----------------------------------+-------------+------------------------------+-----------------------+
2013-03-15 16:24:33 +04:00
| Windows Server 2008 R2 Enterprise|Yes | 3.3 |x86-64 |
2013-03-15 16:10:30 +04:00
+----------------------------------+-------------+------------------------------+-----------------------+
2013-03-15 16:37:00 +04:00
| Windows 8 Pro |Yes | 2.6,2.7,3.2,3.3,PyPy1.9 [1]_ |x86 [2]_ ,x86-64 |
2013-03-15 16:10:30 +04:00
+----------------------------------+-------------+------------------------------+-----------------------+
2013-03-15 08:42:36 +04:00
2013-03-15 16:33:22 +04:00
.. [1] x86 only
2013-03-15 16:37:00 +04:00
.. [2] In some cases, x86 support may indicate 32-bit compilation on 64-bit architecture (vs. compilation on 32-bit hardware).
2013-03-15 16:33:22 +04:00
2013-03-19 09:39:30 +04:00
2013-05-04 04:40:23 +04:00
.. Note :: XXX Why are we recommending binaries when we only provide Windows eggs?
2013-05-04 05:16:03 +04:00
If there is a binary package for your system, that is the easiest way to install Pillow. Currently we only provide binaries for Windows.
.. Note :: UNDONE: Binary links
.. Note :: XXX Do we really need to provide binary links? At least in the case of eggs… probably not IMHO.
2013-03-19 09:39:30 +04:00
2013-05-04 04:45:39 +04:00
Build from source
~~~~~~~~~~~~~~~~~
2013-03-19 09:39:30 +04:00
2013-05-04 05:16:03 +04:00
Some (most?) of Pillow's features require external libraries.
2013-03-19 09:39:30 +04:00
2013-05-04 04:56:09 +04:00
* **libjpeg** provides JPEG functionality.
2013-03-19 09:51:37 +04:00
2013-05-04 05:12:28 +04:00
* Pillow has been tested with libjpeg versions **6b** , **8** , and **9**
2013-03-19 09:51:37 +04:00
2013-05-04 04:56:09 +04:00
* **zlib** provides access to compressed PNGs
2013-03-19 09:51:37 +04:00
2013-05-04 04:56:09 +04:00
* **libtiff** provides group4 tiff functionality
2013-03-19 09:51:37 +04:00
2013-05-04 05:12:28 +04:00
* Pillow has been tested with libtiff versions **3.x** and **4.0**
2013-03-19 09:51:37 +04:00
2013-05-04 04:56:09 +04:00
* **libfreetype** provides type related services
2013-03-19 09:51:37 +04:00
2013-05-04 04:56:09 +04:00
* **littlecms** provides color management
2013-03-19 09:51:37 +04:00
2013-05-16 05:42:45 +04:00
* **libwebp** provides the Webp format.
* Pillow has been tested with version **0.1.3** , which does not read transparent webp files. Version **0.3.0** supports transparency.
2013-03-19 09:39:30 +04:00
2013-05-04 05:16:03 +04:00
If the prerequisites are installed in the standard library locations for your machine (e.g. /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 (i.e. by editing setup.py and/or setup.cfg)
2013-03-19 09:39:30 +04:00
2013-05-04 04:30:51 +04:00
Once you have installed the prerequisites, run:
2013-03-19 09:39:30 +04:00
2013-03-19 09:51:37 +04:00
::
2013-03-19 09:53:41 +04:00
2013-05-04 04:30:51 +04:00
$ pip install Pillow
2013-03-19 09:39:30 +04:00
2013-05-04 04:48:33 +04:00
Platform-specific instructions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2013-03-19 09:39:30 +04:00
2013-05-04 05:10:54 +04:00
Linux
+++++
2013-05-04 05:17:46 +04:00
**We don't currently provide binaries for Linux.** If you didn't build Python from source, make sure you have Python's development libraries installed. In Debian or Ubuntu::
2013-05-04 05:10:54 +04:00
$ sudo apt-get install python-dev python-setuptools
Or for Python 3::
$ sudo apt-get install python3-dev python3-setuptools
Prerequisites are installed on **Ubuntu 10.04 LTS** with::
$ sudo apt-get install libtiff4-dev libjpeg62-dev zlib1g-dev libfreetype6-dev liblcms1-dev
Prerequisites are installed with on **Ubuntu 12.04 LTS** with ::
$ sudo apt-get install libtiff4-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms1-dev libwebp-dev
2013-05-04 04:11:39 +04:00
Mac OS X
2013-05-04 04:45:39 +04:00
++++++++
2013-05-04 04:11:39 +04:00
2013-05-04 05:01:19 +04:00
**We don't currently provide binaries for OS X.** So you'll need XCode to install Pillow. (XCode 4.2 on 10.6 will work with the Official Python binary distribution. Otherwise, use whatever XCode you used to compile Python.)
2013-04-09 23:43:23 +04:00
2013-05-04 05:12:28 +04:00
.. Note :: XXX I'm not sure we need to mention the bit about XCode
2013-05-04 04:51:58 +04:00
The easiest way to install the prerequisites is via `Homebrew <http://mxcl.github.com/homebrew/> `_ . After you install Homebrew, run:
2013-04-09 23:43:23 +04:00
::
2013-05-04 04:20:13 +04:00
$ brew install libtiff libjpeg webp littlecms
2013-04-09 23:43:23 +04:00
2013-05-04 04:11:39 +04:00
If you've built your own Python, then you should be able to install Pillow using
2013-04-09 23:43:23 +04:00
::
2013-05-04 05:01:59 +04:00
$ pip install Pillow
2013-03-19 09:39:30 +04:00
2013-03-19 09:51:37 +04:00
2013-04-09 23:25:55 +04:00
Windows
2013-05-04 04:45:39 +04:00
+++++++
2013-03-19 09:39:30 +04:00
2013-05-04 05:10:54 +04:00
**We currently provide Python eggs for Windows.**
2013-05-04 04:45:39 +04:00
.. Note :: XXX Mention easy_install Pillow (which should install the right egg)?
2013-05-04 04:11:39 +04:00
2013-04-03 04:19:13 +04:00
Donations
---------
You can help fund Pillow development!
.. Note :: New contributors: please add your name (and donation preference) here and send a pull request.
Pillow is a volunteer effort led by Alex Clark. Any contributor interested in receiving donations may add their name (and donation preference) here.
+--------------------------------------+---------------------------------------+
| **Developer** | **Preference** |
+--------------------------------------+---------------------------------------+
| Alex Clark (fork author) | http://gittip.com/aclark4life |
+--------------------------------------+---------------------------------------+
2010-11-28 05:44:38 +03:00
Python Imaging Library
2011-09-07 22:10:25 +04:00
======================
2010-11-28 05:44:38 +03:00
2013-03-09 04:47:20 +04:00
.. Note :: What follows is the original PIL 1.1.7 README file contents.
2013-03-08 18:00:23 +04:00
::
The Python Imaging Library
$Id$
Release 1.1.7 (November 15, 2009)
====================================================================
The Python Imaging Library 1.1.7
====================================================================
Contents
--------
+ Introduction
+ Support Options
- Commercial support
- Free support
+ Software License
+ Build instructions (all platforms)
- Additional notes for Mac OS X
- Additional notes for Windows
--------------------------------------------------------------------
Introduction
--------------------------------------------------------------------
The Python Imaging Library (PIL) adds image processing capabilities
to your Python environment. This library provides extensive file
format support, an efficient internal representation, and powerful
image processing capabilities.
This source kit has been built and tested with Python 2.0 and newer,
on Windows, Mac OS X, and major Unix platforms. Large parts of the
library also work on 1.5.2 and 1.6.
The main distribution site for this software is:
http://www.pythonware.com/products/pil/
That site also contains information about free and commercial support
options, PIL add-ons, answers to frequently asked questions, and more.
Development versions (alphas, betas) are available here:
http://effbot.org/downloads/
The PIL handbook is not included in this distribution; to get the
latest version, check:
http://www.pythonware.com/library/
http://effbot.org/books/imagingbook/ (drafts)
For installation and licensing details, see below.
--------------------------------------------------------------------
Support Options
--------------------------------------------------------------------
+ Commercial Support
Secret Labs (PythonWare) offers support contracts for companies using
the Python Imaging Library in commercial applications, and in mission-
critical environments. The support contract includes technical support,
bug fixes, extensions to the PIL library, sample applications, and more.
For the full story, check:
http://www.pythonware.com/products/pil/support.htm
+ Free Support
For support and general questions on the Python Imaging Library, send
e-mail to the Image SIG mailing list:
image-sig@python.org
You can join the Image SIG by sending a mail to:
image-sig-request@python.org
Put "subscribe" in the message body to automatically subscribe to the
list, or "help" to get additional information. Alternatively, you can
send your questions to the Python mailing list, python-list@python.org,
or post them to the newsgroup comp.lang.python. DO NOT SEND SUPPORT
QUESTIONS TO PYTHONWARE ADDRESSES.
--------------------------------------------------------------------
Software License
--------------------------------------------------------------------
The Python Imaging Library is
Copyright (c) 1997-2009 by Secret Labs AB
Copyright (c) 1995-2009 by Fredrik Lundh
By obtaining, using, and/or copying this software and/or its
associated documentation, you agree that you have read, understood,
and will comply with the following terms and conditions:
Permission to use, copy, modify, and distribute this software and its
associated documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appears in all
copies, and that both that copyright notice and this permission notice
appear in supporting documentation, and that the name of Secret Labs
AB or the author not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR
ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--------------------------------------------------------------------
Build instructions (all platforms)
--------------------------------------------------------------------
For a list of changes in this release, see the CHANGES document.
0. If you're in a hurry, try this:
$ tar xvfz Imaging-1.1.7.tar.gz
$ cd Imaging-1.1.7
$ python setup.py install
If you prefer to know what you're doing, read on.
1. Prerequisites.
If you need any of the features described below, make sure you
have the necessary libraries before building PIL.
feature library
-----------------------------------------------------------------
JPEG support libjpeg (6a or 6b)
http://www.ijg.org
http://www.ijg.org/files/jpegsrc.v6b.tar.gz
ftp://ftp.uu.net/graphics/jpeg/
PNG support zlib (1.2.3 or later is recommended)
http://www.gzip.org/zlib/
OpenType/TrueType freetype2 (2.3.9 or later is recommended)
support
http://www.freetype.org
http://freetype.sourceforge.net
CMS support littleCMS (1.1.5 or later is recommended)
support
http://www.littlecms.com/
If you have a recent Linux version, the libraries provided with the
operating system usually work just fine. If some library is
missing, installing a prebuilt version (jpeg-devel, zlib-devel,
etc) is usually easier than building from source. For example, for
Ubuntu 9.10 (karmic), you can install the following libraries:
sudo apt-get install libjpeg62-dev
sudo apt-get install zlib1g-dev
sudo apt-get install libfreetype6-dev
sudo apt-get install liblcms1-dev
If you're using Mac OS X, you can use the 'fink' tool to install
missing libraries (also see the Mac OS X section below).
Similar tools are available for many other platforms.
2. To build under Python 1.5.2, you need to install the stand-alone
version of the distutils library:
http://www.python.org/sigs/distutils-sig/download.html
You can fetch distutils 1.0.2 from the Python source repository:
svn export http://svn.python.org/projects/python/tags/Distutils-1_0_2/Lib/distutils/
For newer releases, the distutils library is included in the
Python standard library.
NOTE: Version 1.1.7 is not fully compatible with 1.5.2. Some
more recent additions to the library may not work, but the core
functionality is available.
3. If you didn't build Python from sources, make sure you have
Python's build support files on your machine. If you've down-
loaded a prebuilt package (e.g. a Linux RPM), you probably
need additional developer packages. Look for packages named
"python-dev", "python-devel", or similar. For example, for
Ubuntu 9.10 (karmic), use the following command:
sudo apt-get install python-dev
4. When you have everything you need, unpack the PIL distribution
(the file Imaging-1.1.7.tar.gz) in a suitable work directory:
$ cd MyExtensions # example
$ gunzip Imaging-1.1.7.tar.gz
$ tar xvf Imaging-1.1.7.tar
5. Build the library. We recommend that you do an in-place build,
and run the self test before installing.
$ cd Imaging-1.1.7
$ python setup.py build_ext -i
$ python selftest.py
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
During the build process, the setup.py will display a summary
report that lists what external components it found. The self-
test will display a similar report, with what external components
the tests found in the actual build files:
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
----------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
----------------------------------------------------------------
*** TKINTER support not available (Tcl/Tk 8.5 libraries needed)
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- FREETYPE support available
----------------------------------------------------------------
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
Make sure that the optional components you need are included.
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
If the build script won't find a given component, you can edit the
setup.py file and set the appropriate ROOT variable. For details,
see instructions in the file.
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
If the build script finds the component, but the tests cannot
identify it, try rebuilding *all* modules:
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
$ python setup.py clean
$ python setup.py build_ext -i
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
6. If the setup.py and selftest.py commands finish without any
errors, you're ready to install the library:
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
$ python setup.py install
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
(depending on how Python has been installed on your machine,
you might have to log in as a superuser to run the 'install'
command, or use the 'sudo' command to run 'install'.)
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
--------------------------------------------------------------------
Additional notes for Mac OS X
--------------------------------------------------------------------
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
On Mac OS X you will usually install additional software such as
libjpeg or freetype with the "fink" tool, and then it ends up in
"/sw". If you have installed the libraries elsewhere, you may have
to tweak the "setup.py" file before building.
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
--------------------------------------------------------------------
Additional notes for Windows
--------------------------------------------------------------------
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
On Windows, you need to tweak the ROOT settings in the "setup.py"
file, to make it find the external libraries. See comments in the
file for details.
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
Make sure to build PIL and the external libraries with the same
runtime linking options as was used for the Python interpreter
(usually /MD, under Visual Studio).
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
Note that most Python distributions for Windows include libraries
compiled for Microsoft Visual Studio. You can get the free Express
edition of Visual Studio from:
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
http://www.microsoft.com/Express/
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
To build extensions using other tool chains, see the "Using
non-Microsoft compilers on Windows" section in the distutils handbook:
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
http://www.python.org/doc/current/inst/non-ms-compilers.html
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
For additional information on how to build extensions using the
popular MinGW compiler, see:
2010-11-28 18:54:57 +03:00
2013-03-08 18:00:23 +04:00
http://mingw.org (compiler)
http://sebsauvage.net/python/mingw.html (build instructions)
http://sourceforge.net/projects/gnuwin32 (prebuilt libraries)